Question
Problem : Manhattan Cruise Lines sells tickets for dining cruises around Manhattan. It offers three dining options: a la carte, buffet and banquet. It charges
Problem :
Manhattan Cruise Lines sells tickets for dining cruises around Manhattan. It offers three dining options: a la carte, buffet and banquet. It charges different rates for these three options. It also charges differently for lunch versus dinner cruise. The rates are as follows:
Type of Dining | Lunch | Dinner |
a la Carte | $ 49.95 | $ 65.95 |
Buffet | $ 69.95 | $ 89.95 |
Banquet | $ 99.95 | $ 125.95 |
A patron may buy one or more cruise tickets at a time. Weekday tickets are discounted 5% whereas 10% extra is charged for weekend tickets.
Write a program to calculate the cost of buying tickets from Manhattan Cruise Lines.
- It must ask the user for the following inputs:
- Thetype of dining - a/A for a la carte, f/F for buffet and q/Q for banquet. This should be character input. Handle both lower and upper case input.
- The number oftickets.
- Whether the tickets are for lunch or dinner. This should be boolean input.
- Theday of the week: 1 for Monday through 7 for Sunday.
- It must compute:
- Thecost of the purchase, calculated as the product of the cost per ticket and the number of tickets;
- Thediscount/surcharge based on the day of the week, calculated as the product of the discount/surcharge rate and cost;
- Thetotal cost, calculated as the sum of cost and discount/surcharge.
- It must print the results in the format shown in theExpected Sample Run section below.
Expected Sample Runs
You must run your program for the followingfour sets of data:
Sample Run | Type of dining | Number of tickets | Time of the cruise | Day of the show |
A | a la Carte | 2 | Lunch | 1 (Monday) |
B | Buffet | 4 | Dinner | 6 (Saturday) |
C | Banquet | 6 | Dinner | 5 (Friday) |
D | Buffet | 8 | Lunch | 7 (Sunday) |
Your sample runs must lookexactly as follows (your total amount may be off by 1 cent): Sample Run A:
Please enter the type of meal: a/A for a la carte, f/F for buffet and q/Q for banquet
a
Please enter the number of tickets desired
2
Please enter 1 for dinner and 0 for lunch
0
Please enter the day of the week: 1 for Monday and 7 for Sunday
1
The cost of 2 a la carte tickets for Monday lunch cruise is $ 94.91
Thank you for booking with Manhattan Cruise Lines, your salesperson today was Daniel
Sample Run B:
Please enter the type of meal: a/A for a la carte, f/F for buffet and q/Q for banquet
f
Please enter the number of tickets desired
4
Please enter 1 for dinner and 0 for lunch
1
Please enter the day of the week: 1 for Monday and 7 for Sunday
6
The cost of 4 buffet tickets for Saturday dinner cruise is $ 395.78
Thank you for booking with Manhattan Cruise Lines, your salesperson today was Daniel
Sample Run C:
Please enter the type of meal: a/A for a la carte, f/F for buffet and q/Q for banquet
Q
Please enter the number of tickets desired
6
Please enter 1 for dinner and 0 for lunch
1
Please enter the day of the week: 1 for Monday and 7 for Sunday
5
The cost of 6 banquet tickets for Friday dinner cruise is $ 717.91
Thank you for booking with Manhattan Cruise Lines, your salesperson today was Daniel
Sample Run D:
Please enter the type of meal: a/A for a la carte, f/F for buffet and q/Q for banquet
F
Please enter the number of tickets desired
8
Please enter 1 for dinner and 0 for lunch
0
Please enter the day of the week: 1 for Monday and 7 for Sunday
7
The cost of 8 buffet tickets for Sunday lunch cruise is $ 615.56
Thank you for booking with Manhattan Cruise Lines, your salesperson today was Daniel
Implementation Details
- Inputs:
- Accept all character inputs in both lower and upper case.
- Computations:
- Use cast operators wherever necessary.
- Outputs:
- Print all dollar amounts correct to two decimal places.
- Make sure the output of your program isexactly as shown in theExpected Sample Run section.
- Data forms:
- Declare and use symbolic constants whenever applicable.
- Use theappropriate data type for each variable.
- Style:
- Use proper indentation for your code.
- Write the algorithm as comments in your program.
- Factor out code where applicable.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started