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
int
whole pounds 0...200
Calculations
:
All flights include a $50 base charge
Determine total cost for flight:
Îż
Flight class:
•
.
1-
$600
2-
$400
3-
$300
(first class)
(business class)
(economy class)
Determine baggage charge:
Îź If baggage weight is
0 ... 30 pounds
31... 40 pounds
41... 50 pounds
51... 100 pounds
then fee is
$25
$30
$50
$75
$100
•
101... 200 pounds
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 0... 200
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.