Question: I am struggling to write an application in Java that will calculate Zoo admission prices. The application is supposed to do the following. The admission
I am struggling to write an application in Java that will calculate Zoo admission prices.
The application is supposed to do the following.
The admission price can be broken down as follows:
- Base ticket price for admission into the Zoo:
- Adults & Teens - $17
- Children age 2-12 - $13
- Children under 2- Free
- If you are a Zoo member, the admission is free for up to 5 tickets.
- The parking fee is $8, but its free for Zoo members.
- You can rent a stroller/wheelchair at the Zoo. The rental fee is $10 per unit.
- If you are a veteran/in active-duty military, you get a 15% discount on the total ticket price, parking fee, and rental fee.
- After computing all of the above a 7.5% sales tax is applied at the end.
Using the information above, your program must do the following:
- Prompt the user for the number of tickets in each category (Adults & Teens, Children age 2-12, Children under 2).
- Prompt the user for the Zoo membership status (Yes/No).
- Based on the membership status, calculate the total ticket price. Remember, up to 5 tickets are free for Zoo members. If the user tries to purchase more than 5 tickets, display the following message:
- Zoo members can purchase maximum 5 tickets under a membership! If you need to purchase more than 5 tickets, please first purchase the first 5 tickets with member pricing, then purchase additional tickets as a non-member.
- Prompt the user for whether they want to rent a stroller/wheelchair. If yes, prompt the user for the number of units they want to rent.
- Based on the input at step 4, calculate the total price with rentals.
- Add parking fee to the total price. Remember, parking is free for the Zoo members.
- Prompt the user to know whether he/she is a veteran/active-duty military. If yes, update the total price by subtracting the veteran/active-duty military discount.
- Calculate the tax on total price up to this point and add it to get the grand total.
- Use the System.out.printf method to print a receipt in the specified format displayed in the Example Input and Output section.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
