Question: Instructions: 1. Provide the flowchart, complete code and sample output for all of the questions 1. (Modified from 2 nd Semester 2015/2016) Assume that you

Instructions: 1. Provide the flowchart, complete code and sample output for all of the questions

1. (Modified from 2 nd Semester 2015/2016) Assume that you are asked to develop a program for the XYZ Water Theme Park that will calculate the total price of ticket that need to be paid by the visitors. The price of the ticket depends on the age of the visitors as follows:

Instructions: 1. Provide the flowchart, complete code and sample output for all

However, if the visitor holds a membership card, the visitor is eligible for a discount of 20%. The program will prompt the user to provide his/her age and then asks whether the visitor is a member of not. Then, the price of the ticket is calculated. The user is given the option whether to continue with the next transaction or quit the program. Use a do-while and for loop in your program.

The format of the input and output is as follows:

of the questions 1. (Modified from 2 nd Semester 2015/2016) Assume that

you are asked to develop a program for the XYZ Water Theme

Park that will calculate the total price of ticket that need to

Note: The underline texts are the input to the program

You can use this as a guideline:

be paid by the visitors. The price of the ticket depends on

Age 12 and below Between 13 and 60 Above 60 Price (RM) 30.00 60.00 20.00 WELCOME TO XYZ WATER THEME PARK! : 65 How many tickets?: 2 Enter the age of visitor 1 Enter the age of visitor 2 : 15 Membership card?: [Y/N] Y Total amount: RM64.00 THANK YOU. PLEASE COME AGAIN! Do you want to continue? (Please enter an integer or -1 to stop): 1 WELCOME TO XYZ WATER THEME PARK! ***** How many tickets?: 2 Enter the age of visitor 1 : 65 Enter the age of visitor 2 : 15 Membership card?: [Y/N] Y Total amount: RM64.00 THANK YOU. PLEASE COME AGAIN! *** Do you want to continue? (Please enter an integer or -1 to stop): 9876 WELCOME TO XYZ WATER THEME PARK! How many tickets?: 2 Enter the age of visitor 1 : 65 Enter the age of visitor 2 : 15 Membership card?: [Y/N] N Total amount: RM80.00 THANK YOU. PLEASE COME AGAIN! **** Do you want to continue? (Please enter an integer or -1 to stop): 0 WELCOME TO XYZ WATER THEME PARK! How many tickets?: 1 Enter the age of visitor 1 : 10 Membership card?: [Y/N] Y Total amount: RM24.00 THANK YOU. PLEASE COME AGAIN! Do you want to continue? (Please enter an integer or -1 to stop): 1 WELCOME TO XYZ WATER THEME PARK! How many tickets?: 1 Enter the age of visitor 1 : 10 Membership card?: [Y/N) n Total amount: RM30.00 THANK YOU. PLEASE COME AGAIN! Do you want to continue? (Please enter an integer or -1 to stop): -1 import java.util.Scanner; public class Theme Park { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int noTickets; int age; char member; double price = 0, totalPrice = 0.0; int answer; do ! System.out.println("WELCOME TO XYZ WATER THEME PARK!"); System.out.println("* * "); //ask the user to input the number of tickets //loop through the number of tickets //calculate the ticket price //ask user for membership card //calculate total price //display total price //ask user whether the user wants to continue ); //end of do while } while }//end main }//end class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!