Advertisement
MrOstrich

Austin code

Aug 11th, 2023 (edited)
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.24 KB | Source Code | 0 0
  1. import java.util.Scanner ;
  2. class Main
  3. {
  4.     public static void main(String args[])
  5.     {
  6.         Scanner sc = new Scanner(System.in) ;
  7.         int arOPT=0;
  8.         int volOPT=0 ;
  9.         System.out.println("=====Austin's Maths Dockyard // Made by Austin Bara=====");
  10.         System.out.println("==================== Release 1.0 ====================");
  11.         System.out.println(" ");
  12.         System.out.println("It is a program which calculates anything in a sec :>");
  13.         System.out.println("and it also shut downs itself after excuting.");
  14.         System.out.println(" ");
  15.         System.out.println("=====Options=====");
  16.         System.out.println("1. Addition");
  17.         System.out.println("2. Subtraction");
  18.         System.out.println("3. Multiplication");
  19.         System.out.println("4. Division");
  20.         System.out.println("5 Area");
  21.         System.out.println("6. Volume");
  22.         System.out.println(" ");
  23.         System.out.println("Other options comming soon so stay tuned. ");
  24.         System.out.println(" ");
  25.         System.out.print("Select your option: ");
  26.         int OPT = sc.nextInt() ;
  27.         if (OPT == 1)
  28.         {
  29.             System.out.println("You have selected Addition");
  30.             System.out.println(" ");
  31.             System.out.print("Enter your first number: ");
  32.             int a1 = sc.nextInt() ;
  33.             System.out.print("Enter your second number: ");
  34.             int a2 = sc.nextInt() ;
  35.             int sum = a1 + a2 ;
  36.             System.out.println("Sum: "+sum);
  37.         }
  38.         else if (OPT==2)
  39.         {
  40.             System.out.println("You have selected Subtraction");
  41.             System.out.println(" ");
  42.             System.out.print("Input your first number: ");
  43.             int s1 = sc.nextInt();
  44.             System.out.print("Input your second number: ");
  45.             int s2 = sc.nextInt();
  46.             int diff = s1 - s2 ;
  47.             System.out.println("Difference: "+diff);
  48.         }
  49.         else if (OPT == 3)
  50.             {
  51.                 System.out.println("You have selected Multiplication");
  52.                 System.out.println(" ");
  53.                 System.out.print("Input your first number: ");
  54.                 int m1 = sc.nextInt() ;
  55.                 System.out.print("Input your second number: ");
  56.                 int m2 = sc.nextInt() ;
  57.                 int pro = m1 * m2 ;
  58.                 System.out.println("Product: "+pro);
  59.             }
  60.         else if (OPT == 4)
  61.             {
  62.                 System.out.println("You have selected Division");
  63.                 System.out.println(" ");
  64.                 System.out.print("Input your first number: ");
  65.                 int d1 = sc.nextInt();
  66.                 System.out.print("Input your second number: ");
  67.                 int d2 = sc.nextInt();
  68.                 int quo = d1/d2 ;
  69.                 System.out.println("Quotient: "+quo);
  70.             }
  71.         else if (OPT == 5)
  72.             {
  73.                 System.out.println(" ");
  74.                 System.out.println("You have selected Area.");
  75.                 System.out.println(" ");
  76.                 System.out.println("=====Options=====");
  77.                 System.out.println("1. Square");
  78.                 System.out.println("2. Rectangle");
  79.                 System.out.println("3. Circle");
  80.  
  81.                 System.out.print("Select your option: ");
  82.                 arOPT = sc.nextInt();
  83.                 switch (arOPT){
  84.                 case 1 : System.out.println("You have selected Square inside the Area category.");
  85.                              System.out.println(" ");
  86.                              System.out.print("Input the length of a side: ");
  87.                              int sq = sc.nextInt();
  88.                              int sqar = sq * sq ;
  89.                              System.out.println("The area of the square: "+sqar);
  90.                              break;
  91.                 case 2 : System.out.println("You have selected Rectangle inside the Area category.");
  92.                              System.out.println(" ");
  93.                              System.out.print("Input the length of the rectangle: ");
  94.                              int recl = sc.nextInt();
  95.                              System.out.print("Input the breath of the rectangle: ");
  96.                              int recb = sc.nextInt();
  97.                              int recar = recl * recb;
  98.                              System.out.println("The area of the rectangle: "+recar);
  99.                              break;
  100.                 case 3 : System.out.println("You have selected Circle inside the Area category.");
  101.                              System.out.println(" ");
  102.                              System.out.print("Input the radius of the circle: ");
  103.                              double circleR = sc.nextDouble();
  104.                              double cirar = 3.14 * r * r ;
  105.                              System.out.println("The area of the circle: "+cirar);
  106.                              break;
  107.                 default:System.out.println(" ");
  108.                         System.out.println("Invialid Selection");
  109.                         System.out.println("Error code 422: Abnormal Shutdown.");
  110.                 }
  111.             }
  112.         else if (OPT == 6)
  113.             {
  114.                 System.out.println(" ");
  115.                 System.out.println("You have selected Volume.");
  116.                 System.out.println(" ");
  117.                 System.out.println("=====Options=====");
  118.                 System.out.println("1. Cube");
  119.                 System.out.println("2. Cuboid");
  120.                 System.out.print("Select your option: ");
  121.                 volOPT = sc.nextInt();
  122.                 switch (volOPT){
  123.                 case 1 : System.out.println("You have selected Cube inside the Volume category.");
  124.                              System.out.println(" ");
  125.                              System.out.print("Input the length of a edge: ");
  126.                              int ed = sc.nextInt();
  127.                              int cuVOL = ed * ed * ed ;
  128.                              System.out.println("The volume of the square: "+cuVOL);
  129.                              break;
  130.                 case 2 : System.out.println("You have selected Cuboid inside the Volume category.");
  131.                              System.out.println(" ");
  132.                              System.out.print("Input the length of the cuboid: ");
  133.                              int cuL = sc.nextInt();
  134.                              System.out.print("Input the breath of the cuboid: ");
  135.                              int cuB = sc.nextInt();
  136.                              System.out.print("Input the height of the cuboid: ");
  137.                              int cuH = sc.nextInt();
  138.                              int cubVOL = cuL * cuB * cuH ;
  139.                              System.out.println("The volume of the cuboid: "+cubVOL);
  140.                              break;
  141.                 default: System.out.println(" ");
  142.                          System.out.println("Invialid Selection");
  143.                          System.out.println("Error code 422: Abnormal Shutdown.");
  144.             }
  145.         }
  146.         else
  147.         {
  148.              System.out.println(" ");
  149.             System.out.println("Invialid Selection");
  150.             System.out.println("Error code 422: Abnormal Shutdown.");
  151.         }
  152.     }
  153. }
Tags: #Java
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement