Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment: Create a Java program that effectively calculates and displays the ticket booking information based on the number of adult and child tickets entered by

Assignment:
Create a Java program that effectively calculates and displays the ticket booking information based on
the number of adult and child tickets entered by the user. It also considers discounts for both adult and
child tickets, applying them when the respective thresholds are reached. The final cost and discount
information are displayed to the user.
1- Input for Adult Tickets:
The program prompts the user to enter the number of adult tickets they want to purchase.
It checks if the entered value is a valid non-negative integer. If not, it prints an error message and sets
the Boolean variable to false.
2- Calculating Total Cost for Adults: ADULT TICKET PRICE is $12.5
If the entered number of adult tickets is valid, it calculates the total cost for adult tickets
3- Applying Adult Discount: Adult discount is 15% that is .15
If the number of adult tickets exceeds the discount threshold 5 or more, it calculates the discount
amount for adults
It subtracts the discount amount from the total cost for adults.
4- Displaying Ticket Booking Summary for Adults:
It displays the ticket booking summary for adults, including the number of adult tickets and the total cost
for adults, rounded to two decimal places (use the variable for adults ticket*100.0)/100.0
5- Input for Child Tickets:
The program prompts the user to enter the number of child tickets they want to purchase.
It checks if the entered value is a valid non-negative integer. If not, it prints an error message and sets
Boolean variable to false.
6- Calculating Total Cost for Children: CHILD TICKET PRICE is $8.0
If the entered number of child tickets is valid, it calculates the total cost for child tickets
7- Applying Child Discount: Child Discount is 10% that is .1
If the number of child tickets exceeds the discount threshold which is 3 or more, it calculates the
discount amount for children.
It subtracts the discount amount from the total cost for children.
8- Displaying Ticket Booking Summary for Children:
It displays the ticket booking summary for children, including the number of child tickets and the total
cost for children, rounded to two decimal places (use the variable for children tickets*100.0)/100.0
9- Calculating Total Discount Amount and Total Cost:
It calculates the total discount amount by adding the discount amounts for adults and children.
It calculates the overall total cost by adding the total cost for adults and children.
10- Displaying Final Information:
It prints the total discount amount received by the customer.
It prints the total cost that the customer needs to pay, rounded to two decimal pla

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 25th European Conference Adbis 2021 Tartu Estonia August 24 26 2021 Proceedings Lncs 12843

Authors: Ladjel Bellatreche ,Marlon Dumas ,Panagiotis Karras ,Raimundas Matulevicius

1st Edition

3030824713, 978-3030824716

More Books

Students also viewed these Databases questions

Question

2. Describe why we form relationships

Answered: 1 week ago

Question

5. Outline the predictable stages of most relationships

Answered: 1 week ago