- import java.util.Scanner;
- class HelloWorld {
- public static void main(String[] args) {
- //Welcome message
- System.out.println("Welcome to the movie, Puss in boots!\n");
- Scanner input = new Scanner(System.in);
- // Getting String input
- System.out.print("Please enter your name: ");
- String name = input.next();
- System.out.println("Hope you're well, " + name + "! To buy movie tickets, please enter the number of pax:\n");
- //Getting input for tickets
- System.out.print("Adult (RM22.00): ");
- int adult = input.nextInt();
- System.out.print("Children (RM16.00): ");
- int children = input.nextInt();
- System.out.print("Senior Citizen (RM9.00): ");
- int senior = input.nextInt();
- //Thank you message
- System.out.println("Thank you! Please find the summary as below:\n");
- System.out.println("Number of adult: " + adult + " adults");
- int tot_adult = 22 * adult;
- System.out.println("Total price for adults: " + tot_adult);
- System.out.println("Number of children: " + children + " children");
- int tot_children = 16 * children;
- System.out.println("Total price for children: " + tot_children);
- System.out.println("Number of senior citizens: " + children + " senior citizens");
- int tot_senior = 9 * children;
- System.out.println("Total price for senior citizen: " + tot_senior);
- int add = adult + children + senior;
- int total = tot_adult + tot_children + tot_senior;
- System.out.println("Number of tickets purchased: " + add);
- System.out.println("Total price is: " + total);
- System.out.println("Thank you!");
- }
- }
