Roadstar3

Vacation

Jan 15th, 2020
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.00 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Vacation {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int numGroup = Integer.parseInt(scanner.nextLine());
  8.         String typeGroup = scanner.nextLine();
  9.         String typeDay = scanner.nextLine();
  10.         double price = 0;
  11.  
  12.         if (typeGroup.equals("Students")) {
  13.             if (typeDay.equals("Friday")) {
  14.                 price = numGroup * 8.45;
  15.             } else if (typeDay.equals("Saturday")) {
  16.                 price = numGroup * 9.80;
  17.             } else if (typeDay.equals("Sunday")) {
  18.                 price = numGroup * 10.46;
  19.             }
  20.             if (numGroup >= 30) {
  21.                 price *= 0.85;
  22.             }
  23.         } else if (typeGroup.equals("Business")) {
  24.             if (typeDay.equals("Friday")) {
  25.                 if (numGroup >= 100) {
  26.                     price = (numGroup - 10) * 10.90;
  27.                 } else {
  28.                     price = numGroup * 10.90;
  29.                 }
  30.             } else if (typeDay.equals("Saturday")) {
  31.                 if (numGroup >= 100) {
  32.                     price = (numGroup - 10) * 15.60;
  33.                 } else {
  34.                     price = numGroup * 15.60;
  35.                 }
  36.             } else if (typeDay.equals("Sunday")) {
  37.                 if (numGroup >= 100) {
  38.                     price = (numGroup - 10) * 16;
  39.                 } else {
  40.                     price = numGroup * 16;
  41.                 }
  42.             }
  43.         } else if (typeGroup.equals("Regular")) {
  44.             if (typeDay.equals("Friday")) {
  45.                 price = numGroup * 15;
  46.             } else if (typeDay.equals("Saturday")) {
  47.                 price = numGroup * 20;
  48.             } else if (typeDay.equals("Sunday")) {
  49.                 price = numGroup * 22.50;
  50.             }
  51.             if (numGroup >= 10 && numGroup <= 20) {
  52.                 price *= 0.95;
  53.             }
  54.         }
  55.         System.out.printf("Total price: %.2f", price);
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment