daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Jan 29th, 2018 51 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.         if ("march".equals(month) || "april".equals(month) || "may".equals(month)) {
  15.             if ("day".equals(day)) {
  16.                 price = 10.5;
  17.             } else if ("night".equals(day)) {
  18.                 price = 8.4;
  19.             }
  20.         } else if ("june".equals(month) || "july".equals(month) || "august".equals(month)) {
  21.                 if ("day".equals(day)) {
  22.                     price = 12.6;
  23.                 } else if ("night".equals(day)) {
  24.                     price = 10.2;
  25.                 }
  26.             }
  27.  
  28.             if (people >= 4) {
  29.                 price -= price * 0.1;
  30.             }
  31.             if (hours >= 5) {
  32.                 price -= price * 0.5;
  33.             }
  34.             double money = (price * people) * hours;
  35.             System.out.printf("Price per person for one hour: %.2f%n", price);
  36.             System.out.printf("Total cost of the visit: %.2f", money);
  37.         }
  38.     }
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top