class Area {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Enter the given number to find the Area of that shape :" +
"\nPress \n 1 = Circle \n 2 = Triangle \n 3 = Rectangle \n 4 = Isoceles Triangle \n 5 = Parallelogram \n 6 = Rhombus \n 7 = Equilateral Triangle\n");
int n = sc.nextInt();
switch (n){
case 1:
System.out.println("You are finding the area of Circle, please enter the Radius = ");
float R = sc.nextFloat();
float A1 = 3.14f * R * R;
System.out.println("Area = " + A1);
break;
case 2:
System.out.println("You are finding the area of Triangle, please enter the Height & Base = ");
float H = sc.nextFloat();
float B = sc.nextFloat();
float A2 = 0.5f * H * B;
System.out.println("Area = " + A2);
break;
case 3:
System.out.println("You are finding the area of Rectangle, please enter the Length & Bredth = ");
float L = sc.nextFloat();
float b = sc.nextFloat();
float A3 = L * b;
System.out.println("Area = " + A3);
break;
case 4:
System.out.println("You are finding the area of Isoceles Trianglr, please enter the Height & Base = ");
float h = sc.nextFloat();
float base = sc.nextFloat();
float A4 = 0.5f * h * base;
System.out.println("Area = " + A4);
break;
case 5:
System.out.println("You are finding the area of Parallelogram, please enter the Height & Base = ");
float Hi = sc.nextFloat();
float Ba = sc.nextFloat();
float A5 = Hi * Ba;
System.out.println("Area = " + A5);
break;
case 6:
System.out.println("You are finding the area of Rhombus, please enter the Diagonal1 & Diagonal2 = ");
float D1 = sc.nextFloat();
float D2 = sc.nextFloat();
float A6 = 0.5f * D1 * D2;
System.out.println("Area = " + A6);
break;
case 7:
System.out.println("You are finding the area of Equilateral Triangle, please enter the Side = ");
float S = sc.nextFloat();
float A7 = 0.433f * S * S;
System.out.println("Area = " + A7);
break;
default:
System.out.println("You Have Entered a Wrong Number.");
}
}
}