Page 1 of 1

The Gas-N-Wash Service Station sells gasoline and has a car wash. It sells three types of gas - Regular at $2.199, Unlea

Posted: Fri Jul 08, 2022 6:15 am
by answerhappygod
The Gas N Wash Service Station Sells Gasoline And Has A Car Wash It Sells Three Types Of Gas Regular At 2 199 Unlea 1
The Gas N Wash Service Station Sells Gasoline And Has A Car Wash It Sells Three Types Of Gas Regular At 2 199 Unlea 1 (149.9 KiB) Viewed 36 times
The Gas-N-Wash Service Station sells gasoline and has a car wash. It sells three types of gas - Regular at $2.199, Unleaded at $2.399, and Super unleaded at $2.599 per gallon. Car wash charge is $4.95 with a purchase of $30.00 or more otherwise car wash charge is $6.95. Define gas prices as constants: const double Regular = 2.199; const double Unleaded = 2.399; const double Super = 2.599; Declare variables: char gasType, carWash; double dollars, gallons, washCost: Enter the gas type (R- Regular, U- Unleaded, S- Super Unleaded), dollar amount, and Car Wash information (Y or N). Use the following prompt messages: Enter gas type (R, U, or S) Car Wash (Y or N) Enter the dollar amount (After the data entry, clear the screen. Then, display the output.) Do you want to enter another set? (Y/N) _ Write a program that prints a receipt for each customer. If the gas type is 'R', it will display "Regular, if it is 'U', it will display "Unleaded" and if it is 'S', it will display "Super". The display of Gallons is rounded to two digits after decimal point. The Car Wash price and purchase amount have dollar signs and rounded to two digits after decimal point.
The program should have the capability to process multiple set of data. Use a do..while statement with the prompt message "Do you want to enter another set? (Y/N)" You will incorporate an Error trap code to validate the (Y/N) response. If any character other than 'Y' or 'N' (Ex: s, p....) is entered as response; it will display the message "ERROR: Enter Y/N: "(Refer the tip) #1: Sample Data input: Enter gas type (R, U, or S) Car Wash (Y or N) Enter the dollar amount Sample Output: Gas Type Gallons Car Wash (Blank line) Purchase amount :S : Y : 30.00 : Super : 9.64 : $4.95 : $30.00 : Your Name Programmer Do you want to enter another set? (Y/N) Y
TIP: 1. system ("pause"); goes above return 0; 2. system("cls"); goes at the beginning of the display section 3. Use #include <iomanip> to display the numeric format. The currency data are displayed with two digits after decimal point. (Tips: use cout << setprecision(2) << fixed; 4. Error trap code: // Error trap code cout << "Do you want to enter another set? (Y/N) "; cin >> again; again = toupper(again); while ((again != 'Y') && (again != 'N'))//ERROR TRAP { } cout << "ERROR: Enter Y/N: "; cin >> again; again = toupper(again);