Looking for a Tutor Near You?

Post Learning Requirement »
x

Choose Country Code

x

Direction

x

Ask a Question

x

x
x
x
Hire a Tutor

ICSE Important Questions

Loading...

Published in: Java And J2EE
1,284 Views

Java programs for class 9 and 10

Jayeeta B / Kolkata

3 years of teaching experience

Qualification: MCA

Teaches: All Subjects, Computer, Computer Science, School Level Computer

Contact this Tutor
  1. Create a class named rectangle and write a program(source code) in JAVA to accept length and breadth of a rectangle.Find area/perimeter/length of rectangle according to user's choice. import java.io.* class rectangle public static void main(String args[])throws IOException BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter choice"); System.out.println("l:area of rectangle\n2:perimeter of rectangle\n3:length of diagonal of rectangle"); int n=lnteger.parselnt(br.readLine()); System.out.println("Enter length"); System.out.println("Enter breadth"); double 1=Double.parseDouble(br.readLine()); double b=Double.parseDouble (br.readLine()); switch(n) case l:double area=l*b; System.out.println("Area of rectangle is"+area); break; case 2:double perimeter=2*(l+b); System.out.println("Perimeter of rectangle is"+perimeter); break; case 3:double System.out.println("Length of diagonal of rectangle is"+diagonal); break; default:System.out.println("Sorry,Enter Right Key"); break;}
  2. OUTPUT Enter choice l:area of rectangle 2:perimeter of rectangle 3:1ength of diagonal of rectangle 1 Enter length Enter breadth 4 5 Area of rectangle is20.O