import java.util.Scanner;
public class AdvancedCalculator {
public static void main(String[] args) {
int i,j;
double l,w,z, r;
System.out.println("THIS IS ADVANCED CALCULATOR OF MATHS");
System.out.println("1. AREA");
System.out.println("2. VOLUMES");
System.out.println("3. SURFACE AREAS");
System.out.println("ENTER YOUR CHOICE FOR WHAT YOU WANT TO CALCULATE");
Scanner s = new Scanner (System.in);
i=s.nextInt();
switch (i)
{
case 1 :
System.out.println("YOU HAVE CHOSEN AREA");
System.out.println("YOU HAVE FOLLOWING FORMULAS:");
System.out.println("1. Area of rectangle");
System.out.println("2. Area of square");
System.out.println("3. Area of triangle");
System.out.println("4. Area of circle");
System.out.println("5. Area of trapezoid");
System.out.println("6. Area of ellipse");
System.out.println("Enter your choice:");
j=s.nextInt();
switch(j)
{
case 1:
System.out.println("enter the length rectangle");
l=s.nextDouble();
System.out.println("enter the width of rectangle");
w=s.nextDouble();
r= l*w;
System.out.println(" Area of rectangle is :"+r);
break;
case 2:
System.out.println("enter the sides of square");
l=s.nextDouble();
r=l*l;
System.out.println("Area of square is:"+r);
break;
case 3:
System.out.println("Enter the base of triangle");
l=s.nextDouble();
System.out.println("enter the height of triangle");
w=s.nextDouble();
r=0.5*l*w;
System.out.println(" Area of triangle is"+r);
break;
case 4:
System.out.println("enter the radius of circle");
l=s.nextDouble();
r=3.141*l*l;
System.out.println(" Area of circle is"+r);
break;
case 5:
System.out.println("enter the base1 of trapezoid");
l=s.nextDouble();
System.out.println("enter the base2 of trapezoid");
w=s.nextDouble();
System.out.println("enter the height of trapezoid");
z=s.nextDouble();
r=0.5*(l+w)+z;
System.out.println(" Area of trapezoid is"+r);
break;
case 6:
System.out.println("enter the radius of mazor axis");
l=s.nextDouble();
System.out.println("enter the radius of minor axis");
w=s.nextDouble();
r=3.141*l*w;
System.out.println("Area of ellipse is:"+r);
break;
default :
System.out.println("Wrong choice");
break;
}
break;
case 2:
System.out.println("YOU HAVE CHOSEN VOLUME");
System.out.println("YOU HAVE FOLLOWING FORMULAS:");
System.out.println("1. Volume of cuboid");
System.out.println("2. volume of cube");
System.out.println("3. volume of cylinder");
System.out.println("4. volume of prism");
System.out.println("5. volume of sphere");
System.out.println("6. volume of pyramid");
System.out.println("7. Volume of right circular cone");
System.out.println("Enter your choice:");
j=s.nextInt();
switch(j)
{
case 1:
System.out.println("enter the length , breadth and height of cuboid");
l=s.nextDouble();
w=s.nextDouble();
z=s.nextDouble();
r=l*w*z;
System.out.println(" Volume of cuboid is: "+r);
break;
case 2:
System.out.println("enter the side of cube ");
l=s.nextDouble();
r=l*l*l;
System.out.println(" Volume of cube is :"+r);
break;
case 3:
System.out.println("Enter the radius of cylinder");
l=s.nextDouble();
System.out.println("Enter the height of cylinder");
w=s.nextDouble();
r=3.141*l*l*w;
System.out.println("volume of cylinder is : "+r);
break;
case 4:
System.out.println("Enter the are of base of prism");
l=s.nextDouble();
System.out.println("Enter the height");
w=s.nextDouble();
r=l*w;
System.out.println("volume of prism is: "+r);
break;
case 5:
System.out.println("Enter the radius of sphere");
l=s.nextDouble();
r=1.33333*3.141*l*l*l;
System.out.println("volume of sphere is "+r);
break;
case 6:
System.out.println("Enter the base value of pyramid");
l=s.nextDouble();
System.out.println("Enter the height of pyramid ");
w=s.nextDouble();
r=0.333*l*w;
System.out.println("volume of pyramid is "+r);
break;
case 7:
System.out.println("Enter the radius of circular trip of cone");
l=s.nextDouble();
System.out.println("Enter the height");
w=s.nextDouble();
r=0.333*3.141*l*l*w;
System.out.println("volume of right circular cone is "+r);
break;
default :
System.out.println("wrong choice!!!! ");
break;
}
break;
case 3 :
System.out.println("YOU HAVE CHOSEN SURFACE AREAS");
System.out.println("YOU HAVE FOLLOWING FORMULAS:");
System.out.println("1. Surface area of cube");
System.out.println("2. surface area of rectangular prism");
System.out.println("3. surface area of sphere");
System.out.println("4. surface area of cylinder");
System.out.println("Enter your choice:");
j=s.nextInt();
switch(j)
{
case 1:
System.out.println("enter the side of cube ");
l=s.nextDouble();
r=6*l*l;
System.out.println("Surface area of cube is "+r);
break;
case 2:
System.out.println("enter the three sides of rectangular prism");
l=s.nextDouble();
w=s.nextDouble();
z=s.nextDouble();
r=2*l*w+2*w*z+2*z*l;
System.out.println(" Surface area of rectangular prism is : "+r);
break;
case 3:
System.out.println("enter the radius");
l=s.nextDouble();
r=4*3.141*l*l;
System.out.println(" Surface area of sphere is "+r);
break;
case 4:
System.out.println("enter the height and radius");
l=s.nextDouble();
w=s.nextDouble();
r= 2*3.141*w*w+2*3.141*l;
System.out.println(" Surface area of cylinder is "+r);
break;
default :
System.out.println("wrong choice !!!!");
break;
}
break;
default :
System.out.println("wrong choice!!!!");
break;
}
}
}