Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have a code set up, but I am stuck trying to fix it with the if/else statements. I would appreciate if I could compare

I have a code set up, but I am stuck trying to fix it with the "if/else" statements. I would appreciate if I could compare my code with another person's. Thanks.

Edit: It is asking to be done in C++ language.

image text in transcribed

Note:

image text in transcribedimage text in transcribed

Project: 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 15.50 3. U 19.00 4. R 6.50 5. n 6. N r 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. *********** *********** ************ ** * * 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! * ** *********** ***** Here is another example: ** ********* ** ************* *********** * * * * Best Gas and Wash Service Station ************* ************************ * * Gallons purchased: Price per gallon : 15.50 3.01 Total due: 46.66 ** *********************************** * * * Thank you for stopping! Have a nice day and * come again! * **** * ************* * Notice that when the customer chooses not to wash the car, the car wash cost is not displayed on the bill. If the user chooses gas type: 'N', and car wash 'Y' then display only the second part of the bill. If the user decides to leave without any service, print just a message (i.e. do not print an empty bill)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxxviii Special Issue On Database And Expert Systems Applications Lncs 11250

Authors: Abdelkader Hameurlain ,Roland Wagner ,Sven Hartmann ,Hui Ma

1st Edition

3662583836, 978-3662583838

More Books

Students also viewed these Databases questions