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,430 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 triangle and write a menu driven program(source code) in JAVA to find the area of an equilateral triangle,a right angled triangle,a scalene triangle according to user's choice. import java.io.* class triangle public static void main(String args[])throws IOException BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter choice"); System.out.println("1:Area of equilateral triangle\n2:Area of Right angled triangle\n3:Area of scalene triangle"); int n=lnteger.parselnt(br.readLine()); System.out.println("Enter 3 sides"); double a=Double.parseDouble(br.readLine()); double b=Double.parseDouble(br.readLine()); double c=Double.parseDouble(br.readLine()); switch(n) case l:double d=((a*a)+(Math.sqrt(3)))/4; System.out.println("Area of equilateral triangle is"+d); break; case 2:double e=(a*b)/2; System.out.println("Area of right angled triangle is"+e); break; case 3: double f=(1/2)*a*b*Math.sin(c); System.out.println("Area of scalene triangle is"+f); break; default:System.out.println("Sorry,Enter Right Key"); break;}
  2. OUTPUT Enter choice 1:Area of equilateral triangle 2:Area of Right angled triangle 3:Area of scalene triangle 2 Enter 3 sides 2 3 4 Area of right angled triangle is3.O