The following points will be discounted if the related element is missing or incorrect:
Reasonable output formatting [20 points]
Proper names for classes and variables [15 points]
Comments [15 points]
Program doesn’t compile [ 20 points]
Source code (java file) missing [ 15 points]
Executable (class file) missing [15 points]
Missing loop where a loop is required [10 points]
Missing if/else or switch statement where required per program logic [5 points each]
Missing method [5 points each]
In this lab, you will create a program to help travelers book flights and hotel stays. The program will begin by displaying a main menu with a list of options to the user.
======================== Choose from the following menu options: 1) Flights 2) Hotels 3) Display total 9) Exit Enter option:
Withinaloop,displaythemainmenu. Iftheuserentersanoptionthatisnot1,2,3or9,displaythemessage “This option is not acceptable” and loop back to redisplay the menu. Continue in this manner until a correct option is entered (Hint: Create a method called displayMenu() that you can call when your program must display the main menu to the user).
If option 1 is selected, call method getFlightOption() which will prompt the user for a flight option and returns the option the user enters to the main method.
Choose from the following flight options: ————————————————— 1) Morning flight ($500.00) 2) Afternoon flight ($600.00)
3) Evening flight ($700.00) (Press any other number to exit the flight menu and return to the main menu) Enter option:
Based on the flight option entered display a message to the user stating how much the flight costs. For example, if the user selects flight option 3, your program will display the following message:
Your evening flight is booked! Evening flights are $700.00 + tax.
Furthermore, add the cost of the flight the user has selected to a variable called total in the main method. The variable total will be updated based on the selections the user makes (flights and hotel stays).
If option 2 is selected, call method getHotelOption which will prompt the user for the number of nights they plan to stay and returns the number of nights to the main method.
How many nights would you like to stay? Enter the number of nights:
Based on the number of nights entered display a message to the user stating the rate per night. If the user is staying for one night, for example, your program will display the following:
The rate for 1 night is $100.00 + tax
Similarly, you will display messages for the following two cases: If the user is staying for 2 nights, then the rate per night is $120.00 + tax If the user is staying for 3 or more nights, then the rate per night is $130.00 + tax
Your program will update the variable total accordingly.
If option 3 is selected, call method calculateAndDisplayTotal() passing it the variable total. In the method, you will use the total to determine the amount of discount the user will get. You will also display the total before taxes, the discount amount, and the total after the discount including the taxes. Make sure you format your output properly.
The discount will be calculated as follows: If the total before taxes is between 600 and 700, the user gets a 5% discount. If the total is between 700 and 800, the user gets a 10% discount. If the total is greater than 800, the user gets a 15% discount.
Continue this looping until option 9 is selected, at which time the program ends.
Here’s a sample run:
Welcome to Mustang Vacations ============================ Choose from the following menu options: 1) Flights 2) Hotels 3) Display total 9) Exit Enter option: 1
Choose from the following flight options: —————————————– 1) Morning flight ($500.00) 2) Afternoon flight ($600.00)
3) Evening flight ($700.00) (Press any other number to exit the flight menu and return to the main menu) Enter option:3 Your evening flight is booked! Evening flights are $700.00 + tax.
Welcome to Mustang Vacations ============================ Choose from the following menu options: 1) Flights 2) Hotels 3) Display total
9) Exit Enter option: 2
How many nights would you like to stay? Enter the number of nights: 5 For a 3 or more nights’ stay, the rate per night is $130.00 + tax. Your stay is booked.
Welcome to Mustang Vacations ============================ Choose from the following menu options: 1) Flights 2) Hotels 3) Display total 9) Exit Enter option: 3
Your total before taxes is: $1350.00 You received a discount of: $202.50 Your total after discount + taxes is: $1242.17
Welcome to Mustang Vacations ============================ Choose from the following menu options: 1) Flights 2) Hotels 3) Display total 9) Exit Enter option: 9 Good-bye
Select your paper details and see how much our professional writing services will cost.
Our custom human-written papers from top essay writers are always free from plagiarism.
Your data and payment info stay secured every time you get our help from an essay writer.
Your money is safe with us. If your plans change, you can get it sent back to your card.
We offer more than just hand-crafted papers customized for you. Here are more of our greatest perks.
Get instant answers to the questions that students ask most often.
See full FAQ