Question: Write a Java program that will calculate the cost of an airline flight for one customer. Input: ( Using Java dialog boxes ) Flight class:

Write a Java program that will calculate the cost of an airline flight for one customer.
Input: (Using Java dialog boxes)
Flight class:
int
1,2, or 3
Baggage weight
whole pounds 0dots200
Calculations
All flights include a $50 base charge
Determine total cost for flight:
Flight class:
1$600,(first class)
2$400,(business class)
3$300,(economy class)
Determine baggage charge:
If baggage weight is
0...30 pounds
then fee is ...
31...40 pounds
$25
41 $30
51dots..50 pounds $50
51dots100 pounds $75
101dots200 pounds $100
Tax: 5% on flight cost only (excluding base charge and baggage fees)
Output: (using one Java dialog box)
Summary of costs including itemized list with base cost, flight cost, baggage fees, tax, and total
Include error-checking (upstream from calculations and output) in the form of a while-loop to validate the
following:
Flight class value input is only a 1,2, or 3
Baggage weight is 0dots200
If any input is out of range, provide an error message, "trap" the user in a loop, and give them another
opportunity to re-enter input.
Write a Java program that will calculate the cost

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 Programming Questions!