public class MoviePrices
2: import java.util.Scanner;
4: /**
5: * A program to calculate how much a customer must pay to see a movie.
6: *
7: * @author Mark Young (A00000000)
8: */
9: public class MoviePrices {
11: public static void main(String[] args) {
12: // create variables
13: Scanner kbd = new Scanner(System.in);
14: int age;
15: double price;
16:
17: // introduce yourself
18: System.out.println("\nWelcome to the movies. The price of admission "
19: + "depends on your age.\n");
21: // get customer's age
22: System.out.print("How old are you? ");
23: age = kbd.nextInt();
24: kbd.nextLine();
25: System.out.println();
26:
27: // select the price -- ONE OF THESE FOUR
28: // - children (under 12) pay 2.99
29: // - youth (12 to 17) pay 7.99
30: // - seniors (65 or older) pay 6.99
31: // - others pay regular admission 8.99
32: if (age < 12) {
33: System.out.println("Children's price.");
34: price = 2.99;
35: } else if (age < 18) {
36: System.out.println("Youth's price.");
37: price = 7.99;
38: } else if (age < 65) {
39: System.out.println("Regular price.");
40: price = 8.99;
41: } else {
42: System.out.println("Senior's price");;
43: price = 6.99;
44: }
45:
46: // tell them the price
47: System.out.println("That'll be $" + price + ", please.\n");
48: }
50: }