/**
 * TicketSalesExtended.java
 *
 * Demonstrates the use of conditional statements, 
 * adding a third case from the two in the original version.
 * 
 * See TicketSalesExtendedFactored for a factored version.
 *
 * Computer Science S-111
 */

import java.util.Scanner;

public class TicketSalesExtended {
    public static void main(String[] args) {
        Scanner console = new Scanner(System.in);                
        System.out.print("Enter your age: ");
        int age = console.nextInt();
        
        if (age < 13) {
            System.out.println("You cannot buy a ticket.");
        } else if (age < 25) {
            // handle people younger than 25
            System.out.print("orchestra or balcony? ");
            String choice = console.next();            
            
            int price;
            if (choice.equalsIgnoreCase("orchestra")) {
                price = 35;
            } else {
                price = 20;
            }
            System.out.println("The price is $" + price);
        } else {
            // handle people 25 and older
            System.out.print("orchestra or balcony? ");
            String choice = console.next();            
            
            int price;
            if (choice.equalsIgnoreCase("orchestra")) {
                price = 50;
            } else {
                price = 30;
            }
            System.out.println("The price is $" + price);
        }
    }
}
