Advertisement
bobo_bobkata

Untitled

Jan 24th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.53 KB | None | 0 0
  1. Scanner scanner = new Scanner(System.in);
  2.  
  3.  
  4.         double people = Double.parseDouble(scanner.nextLine());
  5.         String groupType = scanner.nextLine();
  6.         String day = scanner.nextLine();
  7.         double total = 0;
  8.         if(groupType.equals("Students")){
  9.             if(day.equals("Friday")){
  10.             total+=people*8.45;
  11.             }else if(day.equals("Saturday")){
  12.                 total+=people*9.8;
  13.             }else if(day.equals("Sunday")){
  14.                 total+=people*10.46;
  15.             }
  16.             if(people >= 30){
  17.                 total=total- total*0.15;
  18.             }
  19.         }else if (groupType.equals("Business")){
  20.             if(day.equals("Friday")){
  21.                 total+=people*10.9;
  22.             }else if(day.equals("Saturday")){
  23.                 total+=people*15.6;
  24.             }else if(day.equals("Sunday")){
  25.                 total+=people*16;
  26.             }
  27.             if(people >= 100){
  28.                 double discount = total / people;
  29.                 discount = discount*10;
  30.                 total=total-discount;
  31.             }
  32.  
  33.         }else if (groupType.equals("Regular")){
  34.             if(day.equals("Friday")){
  35.                 total+=people*15;
  36.             }else if(day.equals("Saturday")){
  37.                 total+=people*20;
  38.             }else if(day.equals("Sunday")){
  39.                 total+=people*22.5;
  40.             }
  41.             if(people >= 10&& people<=20){
  42.                total-=total*0.05;
  43.             }
  44.  
  45.         }
  46.         System.out.printf("Total price: %.2f",total);
  47.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement