Question
Checkpoints Absolutely no arrays or structures. The problem is designed to be solved using primitive types only: int, float, double, char. Also, ABSOLUTELY NO GLOBAL
Checkpoints Absolutely no arrays or structures. The problem is designed to be solved using primitive types only: int, float, double, char. Also, ABSOLUTELY NO GLOBAL VARIABLE DECLARATIONS. All variables need to be declared in main() or another function.
1) Include name, e-mail, and lab# as comment and print same to output
2) Minimum of three (3) comments in each function (Purpose: Pre: Post:)
3) Input may not be case sensitive. That is, if user enters s change it to S immediately. To do this use if() and assign uppercase value or, better, use toupper() function (see 10.2 on page 545 of text).
Only an error message should be output and nothing more if data is erroneous. Use exit() function as explained in 6.15 (p. 360). This applies to test data #3.
4) A function must be used to calculate the ride fare
5) One function must be used for all the output
6) Output must be formatted using dollar sign and 2 decimal place as shown on page 1 of the lab write-up.
TEST DATA: Execute program three (3) times & each time copy and paste the output to the bottom of the source code as a comment.
1) Mary Pape,34.6,25.5,X,Y. 1.9
2) Taylor Swift, 15, 16.8, L, N
3) Jason Rider, 45, 13.8, C, N
Write a C++ program to simulate uber's method of calculating cost of ride INPUT Your program is to prompt the user for - Rider's first and last name in one prompt - the length of ride in minutes - the distance of ride in miles - code of 'X'for uberX (Uber's budget option) or code of 'S' for SUV, or 'L' for luxury car. - code for whether or not there is a surge for the trip. Letter'Y' for yes and 'N' for no. - if and only if code for surge is Y ask the user for the surger multiplier CALCULATE Calculate the total fare as base fare per minute x number of minutes + per milex number of miles. If there is a surge fee then multiple the base fare by the surge fee before calculating total fare. If total fare is less than minium fee then total fare is set equal to minimum fare. Use the following fee schedule: Type of vehicle base fare per minute UberX $ 2.00 $ 0.22 SUV $15.00 $ 0.90 Luxury $ 5.00 $ 0.50 OUTPUT A sample run might look like this: per mile $ 1.15 3.75 $ 2.75 Minimum fare S 6.55 $ 25.00 $10.55 Enter name: Mary Pape Enter enter time in minutes: 70 Enter enter distance: 55 Enter X for uberX or 'S' for SUV or 'L for luxury Enter Y if surge or 'N' if not: Y Enter surge multiplier: 1.9 Rider's name: Mary Pape Total: $ 82.45 TEST DATA: Execute program three (3) times & each time copy and paste the output to the bottom of the source code as a comment. 1) Mary Pape, 70,55,X,Y. 1.9 2) Taylor Swift, 15, 16,8,L, N 3) Jason Rider, 45, 13.8, CN THEME ISSUES Functions (pass by value), IF Control Structures, character type
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