Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner ;
- class Main
- {
- public static void main(String args[])
- {
- Scanner sc = new Scanner(System.in) ;
- int arOPT=0;
- int volOPT=0 ;
- System.out.println("=====Austin's Maths Dockyard // Made by Austin Bara=====");
- System.out.println("==================== Release 1.0 ====================");
- System.out.println(" ");
- System.out.println("It is a program which calculates anything in a sec :>");
- System.out.println("and it also shut downs itself after excuting.");
- System.out.println(" ");
- System.out.println("=====Options=====");
- System.out.println("1. Addition");
- System.out.println("2. Subtraction");
- System.out.println("3. Multiplication");
- System.out.println("4. Division");
- System.out.println("5 Area");
- System.out.println("6. Volume");
- System.out.println(" ");
- System.out.println("Other options comming soon so stay tuned. ");
- System.out.println(" ");
- System.out.print("Select your option: ");
- int OPT = sc.nextInt() ;
- if (OPT == 1)
- {
- System.out.println("You have selected Addition");
- System.out.println(" ");
- System.out.print("Enter your first number: ");
- int a1 = sc.nextInt() ;
- System.out.print("Enter your second number: ");
- int a2 = sc.nextInt() ;
- int sum = a1 + a2 ;
- System.out.println("Sum: "+sum);
- }
- else if (OPT==2)
- {
- System.out.println("You have selected Subtraction");
- System.out.println(" ");
- System.out.print("Input your first number: ");
- int s1 = sc.nextInt();
- System.out.print("Input your second number: ");
- int s2 = sc.nextInt();
- int diff = s1 - s2 ;
- System.out.println("Difference: "+diff);
- }
- else if (OPT == 3)
- {
- System.out.println("You have selected Multiplication");
- System.out.println(" ");
- System.out.print("Input your first number: ");
- int m1 = sc.nextInt() ;
- System.out.print("Input your second number: ");
- int m2 = sc.nextInt() ;
- int pro = m1 * m2 ;
- System.out.println("Product: "+pro);
- }
- else if (OPT == 4)
- {
- System.out.println("You have selected Division");
- System.out.println(" ");
- System.out.print("Input your first number: ");
- int d1 = sc.nextInt();
- System.out.print("Input your second number: ");
- int d2 = sc.nextInt();
- int quo = d1/d2 ;
- System.out.println("Quotient: "+quo);
- }
- else if (OPT == 5)
- {
- System.out.println(" ");
- System.out.println("You have selected Area.");
- System.out.println(" ");
- System.out.println("=====Options=====");
- System.out.println("1. Square");
- System.out.println("2. Rectangle");
- System.out.println("3. Circle");
- System.out.print("Select your option: ");
- arOPT = sc.nextInt();
- switch (arOPT){
- case 1 : System.out.println("You have selected Square inside the Area category.");
- System.out.println(" ");
- System.out.print("Input the length of a side: ");
- int sq = sc.nextInt();
- int sqar = sq * sq ;
- System.out.println("The area of the square: "+sqar);
- break;
- case 2 : System.out.println("You have selected Rectangle inside the Area category.");
- System.out.println(" ");
- System.out.print("Input the length of the rectangle: ");
- int recl = sc.nextInt();
- System.out.print("Input the breath of the rectangle: ");
- int recb = sc.nextInt();
- int recar = recl * recb;
- System.out.println("The area of the rectangle: "+recar);
- break;
- case 3 : System.out.println("You have selected Circle inside the Area category.");
- System.out.println(" ");
- System.out.print("Input the radius of the circle: ");
- double circleR = sc.nextDouble();
- double cirar = 3.14 * r * r ;
- System.out.println("The area of the circle: "+cirar);
- break;
- default:System.out.println(" ");
- System.out.println("Invialid Selection");
- System.out.println("Error code 422: Abnormal Shutdown.");
- }
- }
- else if (OPT == 6)
- {
- System.out.println(" ");
- System.out.println("You have selected Volume.");
- System.out.println(" ");
- System.out.println("=====Options=====");
- System.out.println("1. Cube");
- System.out.println("2. Cuboid");
- System.out.print("Select your option: ");
- volOPT = sc.nextInt();
- switch (volOPT){
- case 1 : System.out.println("You have selected Cube inside the Volume category.");
- System.out.println(" ");
- System.out.print("Input the length of a edge: ");
- int ed = sc.nextInt();
- int cuVOL = ed * ed * ed ;
- System.out.println("The volume of the square: "+cuVOL);
- break;
- case 2 : System.out.println("You have selected Cuboid inside the Volume category.");
- System.out.println(" ");
- System.out.print("Input the length of the cuboid: ");
- int cuL = sc.nextInt();
- System.out.print("Input the breath of the cuboid: ");
- int cuB = sc.nextInt();
- System.out.print("Input the height of the cuboid: ");
- int cuH = sc.nextInt();
- int cubVOL = cuL * cuB * cuH ;
- System.out.println("The volume of the cuboid: "+cubVOL);
- break;
- default: System.out.println(" ");
- System.out.println("Invialid Selection");
- System.out.println("Error code 422: Abnormal Shutdown.");
- }
- }
- else
- {
- System.out.println(" ");
- System.out.println("Invialid Selection");
- System.out.println("Error code 422: Abnormal Shutdown.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement