Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.41 KB | None | 0 0
  1. assert_i        System.out.println("Welcome to the GummyBear Online Store");
  2.         System.out.println("Retailer . . . . . . ");
  3.         System.out.println();
  4.         Scanner scan = new Scanner(System.in);
  5.         System.out.print("Enter the type of candy: ");
  6.         String candy = scan.nextLine();
  7.         if (candy.equals("gummy bear")) {
  8.         System.out.print("Enter the price of the candy: ");
  9.             String price = scan.nextLine();
  10.             if (price.equals("20")) {
  11.             System.out.println();
  12.                 System.out.println("Costumer . . . . . . ");
  13.                 System.out.print("Enter the number of gummy bears: ");
  14.                 int n = scan.nextInt();
  15.                
  16.                 if(n <= 10) {
  17.                     System.out.println();
  18.                     System.out.println("Order Summary ...");
  19.                     System.out.println("Candy Units Price/Unit Cost");
  20.                     System.out.println("---------------------------------------------");
  21.                     System.out.println("Gummy Bear " + n + " 20$ " + (n * 20) + "$");
  22.                     System.out.println("---------------------------------------------");
  23.                     System.out.println("Total order cost " + (n * 20));
  24.                     System.out.println("Total order tax: " + (n * 20)*0.075);
  25.                     System.out.println("Grand Total: " + (n * 20)*1.075);
  26.                 }
  27.                 if(n > 10) {
  28.                     if(n > 10) {
  29.                         System.out.println();
  30.                         System.out.println("Order Summary ...");
  31.                         System.out.println("Candy Units Price/Unit Cost");
  32.                         System.out.println("---------------------------------------------");
  33.                         System.out.println("Gummy Bear 10 20$ 200$");
  34.                         System.out.println("Gummy Bear " + (n-10) + " 18$ " + (n-10)*0.9*20 + "$");
  35.                         System.out.println("---------------------------------------------");
  36.                         System.out.println("Total order cost " + (200+(n-10)*0.9*20));
  37.                         System.out.println("Total order tax: " + ((200+(n-10)*0.9*20)*0.075));
  38.                         System.out.println("Grand Total: " + ((200+(n-10)*0.9*20)*1.075));
  39.                 }
  40.                 }
  41.                     else {
  42.                     System.out.println("error");
  43.                 }
  44.             }
  45.                
  46.     }
  47.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement