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
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);