Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

*Write a program that computes the tax and tip on a restaurant bill for a patron

ID: 3878145 • Letter: #

Question

*Write a program that computes the tax and tip on a restaurant bill for a patron based on what they ordered. The tax should be 6.75 percent of the meal cost, if the service was good the tip should be 20 percent of the total after adding the tax, if the service was poor the tip should be 1 596. Display the meal cost, tax amount, tip amount, and the total bill on the screen. Utilize at least one constant variable. *Your program will be tested against different inputs.* Suggestion: Complete each part one at a time to ensure at least some credit. Use at least one constant variable.* (1) Ask the user for the price of the three items that they ordered. Output the total of the items. (Submit for 5 point) What was the price of each of the items that you ordered? Item 1: [display your amount] Item 2: $ [display your amount] Item 3: $ [display your amount] Your items total: (2) Compute the tax owed on the meal and the new subtotal including tax. North Carolinas food tax is a rate of 6.75% (Submit for 5 points. Item 1: $ [display your amount Item 2: $ [display your amount Item 3: $ [display your amount] Your items total: [display your amount] The tax owed on your bill is: $Idisplay your amount] Your subtotal is now: $[display your amount] 3) Allow your user to determine the level of tip they would like to leave the user. Show them their final total with the tip included. Item 1: $ [display your amount Item 2: $ [display your amount Item 3: $ [display your amount Your items total: [display your amount] The tax oWed on vour hill:SIdisplay vour amountl

Explanation / Answer

#include <iostream>
#include <string>
using namespace std;

int main() {
double subtotal;
double tipamount, total, item1, item2, item3, taxtotal;
string tip;
  
cout << "What was the price of the items that you ordered? ";
cout << "Item 1: $";
cin >> item1;
cout << "Item 2: $";
cin >> item2;
cout << "Item 3: $";
cin >> item3;
  
total = item1 + item2 + item3;
cout << endl<< "Your items total: $" << total << endl;
  
taxtotal = 6.75*total/100.0;
cout << "The tax owed on your bill is: $" << taxtotal<< endl;
subtotal = total + taxtotal;
cout << "Your subtotal is now : $" << subtotal << endl;
  
cout << "Input 'good' or 'poor' to determine the tip amount: ";
cin >> tip;
  
if(tip.compare("good") == 0)
{
tipamount = 20*subtotal/100.0;
}
else
{
tipamount = 15*subtotal/100.0;
}
  
cout << "Your tip amount is: $" << tipamount << endl;
  
total += tipamount;
cout << "Your new total is: $" << total;
}

/*
What was the price of the items that you ordered?
Item 1: $ 100
Item 2: $ 200
Item 3: $ 300

Your items total: $600
The tax owed on your bill is: $40.5
Your subtotal is now : $640.5
Input 'good' or 'poor' to determine the tip amount: good
Your tip amount is: $128.1
Your new total is: $728.1
*/