SHARE
TWEET
Untitled
a guest
Jan 29th, 2018
51
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- import java.util.Scanner;
- public class Aquapark {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String month = scanner.nextLine().toLowerCase();
- int hours = Integer.parseInt(scanner.nextLine());
- int people = Integer.parseInt(scanner.nextLine());
- String day = scanner.nextLine().toLowerCase();
- double price = 0;
- if ("march".equals(month) || "april".equals(month) || "may".equals(month)) {
- if ("day".equals(day)) {
- price = 10.5;
- } else if ("night".equals(day)) {
- price = 8.4;
- }
- } else if ("june".equals(month) || "july".equals(month) || "august".equals(month)) {
- if ("day".equals(day)) {
- price = 12.6;
- } else if ("night".equals(day)) {
- price = 10.2;
- }
- }
- if (people >= 4) {
- price -= price * 0.1;
- }
- if (hours >= 5) {
- price -= price * 0.5;
- }
- double money = (price * people) * hours;
- System.out.printf("Price per person for one hour: %.2f%n", price);
- System.out.printf("Total cost of the visit: %.2f", money);
- }
- }
RAW Paste Data

