Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class TheatrePromotion {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String day = scanner.nextLine();
- int age = Integer.parseInt(scanner.nextLine()),
- sum = 0;
- if (age >= 0 && age < 123) {
- sum = switch (day) {
- case "Weekday" -> age > 18 && age <= 64 ? 18 : 12;
- case "Weekend" -> age > 18 && age <= 64 ? 20 : 15;
- case "Holiday" -> age <= 18 ? 5 : age > 64 ? 10 : 12;
- default -> sum;
- };
- }
- System.out.println(sum == 0 ? "Error!" : String.format("%d$", sum));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement