daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Jan 29th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Aquapark {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         String month = scanner.nextLine().toLowerCase();
  8.         int hours = Integer.parseInt(scanner.nextLine());
  9.         int people = Integer.parseInt(scanner.nextLine());
  10.         String day = scanner.nextLine().toLowerCase();
  11.  
  12.         double price = 0;
  13.  
  14.         switch (month) {
  15.             case "march":
  16.             case "april":
  17.             case "may":
  18.                 if ("day".equals(day)) {
  19.                     price = 10.5;
  20.                 } else if ("night".equals(day)) {
  21.                     price = 8.4;
  22.                 }
  23.                 break;
  24.             case "june":
  25.             case "july":
  26.             case "august":
  27.                 if ("day".equals(day)) {
  28.                     price = 12.6;
  29.                 } else if ("night".equals(day)) {
  30.                     price = 10.2;
  31.                 }
  32.                 break;
  33.         }
  34.  
  35.         if (people >= 4) {
  36.             price -= price * 0.1;
  37.         }
  38.         if (hours >= 5) {
  39.             price -= price * 0.5;
  40.         }
  41.         double money = (price * people) * hours;
  42.         System.out.printf("Price per person for one hour: %.2f%n", price);
  43.         System.out.printf("Total cost of the visit: %.2f", money);
  44.     }
  45. }
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top