Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TheatrePromotions {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- String dayType = scan.nextLine();
- int age = Integer.parseInt(scan.nextLine());
- String price = "Error!";
- if (dayType.equals("Weekday")) {
- if ((age >= 0 && age <= 18) || (age >= 64 && age <= 122)) {
- price = "12$";
- } else if (age >= 18 && age <= 64) {
- price = "18$";
- }
- } else if (dayType.equals("Weekend")) {
- if ((age >= 0 && age <= 18) || (age >= 64 && age <= 122)) {
- price = "15$";
- } else if (age >= 18 && age <= 64) {
- price = "20$";
- }
- } else if (dayType.equals("Holiday")) {
- if (age >= 0 && age <= 18) {
- price = "5$";
- } else if (age >= 18 && age <= 64) {
- price = "12$";
- } else if (age >= 64 && age <= 122) {
- price = "10$";
- }
- }
- System.out.println(price);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement