Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ZadachiOtIzpita2;
- import java.util.Scanner;
- public class ComputerRoom {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String month = scanner.nextLine();
- int hours = Integer.parseInt(scanner.nextLine());
- int groupSize = Integer.parseInt(scanner.nextLine());
- String dayTime = scanner.nextLine();
- double price = 0;
- switch (month) {
- case "march":
- case "april":
- case "may":
- {
- switch (dayTime) {
- case "day":
- price = 10.5;
- break;
- case "night":
- price = 8.4;
- break;
- }break;
- }
- case "june":
- case "july":
- case "august":
- switch (dayTime) {
- case "day":
- price = 12.6;
- break;
- case "night":
- price = 10.2;
- break;
- }break;
- }
- if (groupSize >= 4) {
- price *= 0.9;
- }
- if (hours >= 5) {
- price *= 0.5;
- }
- double totalPrice = price * groupSize * hours;
- System.out.printf("Price per person for one hour: %.2f\n", price);
- System.out.printf("Total cost of the visit: %.2f", totalPrice);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement