Advertisement
Ivelin_Arsov

TicketsPromotions

May 20th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.12 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TheatrePromotions {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.         String dayType = scan.nextLine();
  7.         int age = Integer.parseInt(scan.nextLine());
  8.         String  price = "Error!";
  9.  
  10.         if (dayType.equals("Weekday")) {
  11.             if ((age >= 0 && age <= 18) || (age >= 64 && age <= 122)) {
  12.                 price = "12$";
  13.             } else if (age >= 18 && age <= 64) {
  14.                 price = "18$";
  15.             }
  16.         } else if (dayType.equals("Weekend")) {
  17.             if ((age >= 0 && age <= 18) || (age >= 64 && age <= 122)) {
  18.                 price = "15$";
  19.             } else if (age >= 18 && age <= 64) {
  20.                 price = "20$";
  21.             }
  22.  
  23.         } else if (dayType.equals("Holiday")) {
  24.             if (age >= 0 && age <= 18) {
  25.                 price = "5$";
  26.             } else if (age >= 18 && age <= 64) {
  27.                 price = "12$";
  28.             } else if (age >= 64 && age <= 122)  {
  29.                 price = "10$";
  30.             }
  31.         }
  32.         System.out.println(price);
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement