please solve this worksheet it is java chapter
Answers
Answer:
//question1
import java.util.*;
class Main {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
String name=s.next();
for(int i=0;i<4;i++)
System.out.print(name+" ");
}
}
//Question2
import java.util.*;
class Main
{
public static void main(String args[]){
String name;
int rollno;
String Class;
Scanner s=new Scanner(System.in);
rollno=s.nextInt();
name=s.next();
Class=s.next();
System.out.println("The student name is "+name);
System.out.println("The Student rollno is "+rollno);
System.out.println("The student studying in "+Class);
}
}
//question3
import java.util.*;
class Main
{
public static void main(String args[]){
int principle;
double interest;
int time;
Scanner s=new Scanner(System.in);
principle=s.nextInt();
interest=s.nextDouble();
time=s.nextInt();
double SI=(principle*interest*time)/100;
System.out.println("The simple interest is "+SI);
}
}
//question4
import java.util.*;
class Main
{
public static void main(String args[]){
double bill;
Scanner s=new Scanner(System.in);
bill=s.nextDouble();
double tax=bill*5/100;
double total=bill+tax;
System.out.println(total);
}
}
//question5
import java.util.*;
class Main
{
public static void main(String args[]){
int length;
int breadth;
Scanner s=new Scanner(System.in);
length=s.nextInt();
breadth=s.nextInt();
double area=length*breadth;
double perimeter=2*(length+breadth);
System.out.println("Area is "+area);
System.out.println("Perimeter is "+perimeter);
}
}
Explanation:
Hope this is helpful