Question: I'm a C++ beginner, I'm not sure how to do this. Calculate the amount a customer should be charged at a gas station. Fees for
I'm a C++ beginner, I'm not sure how to do this.
Calculate the amount a customer should be charged at a gas station.
Fees for the car wash are $4.25 with gasoline purchase of $35.00 or more and $10.00
otherwise. Three kinds of gasoline are available: regular at 3.39, unleaded at 3.55 and
premium at 3.65 per gallon. Input consists of the customer number, number of gallons
purchased, kind of gasoline purchased (R, U, P, or, for no purchase, N), and car wash
desired (Y or N).
You are in charge of completely testing the program. Do not forget to include input
validation for incorrect values. Run your program at least six times with the test data
shown below for gas type, gallons, and car wash in this order:
1. P 10.02 Y
2. r 15.50 N
3. U 19.00 y
4. R 6.50 y
5. n Y
6. N n
The program is to prompt the user for the input as shown below:
Gas type (R, U, P, N) : P
Number of gallons : 10.02
Car wash? [Y/N] : Y
If the user chooses gas type: 'N', the number of gallons should be set to 0.
Write the bill to an output file as shown below. Be careful to align the decimal points.
Prompt the user to enter the name of the output file.
Write the bill to an output file as shown below. Be careful to align the decimal points. Prompt the user to enter the name of the output file. * * * * * * * * * * * * * * * * * * * * * * * * * * ** * * ** * * ** * * * * Best Gas and Wash Service Station ************************************* * Gallons purchased: Price per gallon : 10.02 3.23 Total gasoline cost: 32.36 Car wash cost: 3.25 ------ Total due: 35.61 * * * * ** * * ** * * * * * * * ** * * ** * * * * * * * ** * * * * * * Thank you for stopping! Have a nice day and come again! * * * ** * * ** * * * ** * * ** *
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
