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

Write a program for Q4 of P81 from the book (shown right below) with the followi

ID: 3696132 • Letter: W

Question

Write a program for Q4 of P81 from the book (shown right below) with the following changes:

Restaurant Bill Write a program that computes the tax and tip on a restaurant bill for a patron with a $88.67 meal charge. The tax should be 6.75 percent of the meal cost. The tip should be 20 percent of the total after adding the tax. Display the meal cost, tax amount, tip amount, and total bill on the screen.

The program should accept user input for the ‘meal cost’, i.e. $44.50 should be entered from the keyboard. You can also choose to have multiple meal items of various prices as long as their total adds up to $44.50 before tax and tip.

Declare variables for tax and tip percentages and any calculated amounts - use the variables in your calculations.

The program should output all the prescribed information (meal cost, tax amount, tip amount and total bill) formatted in the form of a typical receipt one gets at a restaurant - name, address of restaurant, time of transaction, meal, tip and tax details, ending message - all aligned properly.  Look at a McDonald's, Subway or similar receipt for sample ideas.

Include a flowchart in your solution.

HINT: For formatting, try to use escape characters.

Things to remember:

Be sure to include code, flowchart and output in your submission –

Code file should be your CPP file.

Output should be a screen capture of a single run of your program saved as a JPG or PNG file.

Output should be clearly readable – Mac users do not capture the entire Xcode window, just the output window. Similarly, Windows users change the resolution of your execution window to make it readable.

For flowchart – you can hand-draw it and take a picture or use any free online tool but remember to export the output as a picture (JPG or PNG) to include in the submission.

Compress all three files into a single zip file with filename pattern that contains your name like- CIS22A_Lab2_yourname.zip.

Remember - Assignments will be graded for documentation and output formatting styles.

*I use microsoft visual studio 2013 (C++)

Explanation / Answer

/** C++ code that computes the tax and tip on a restaurant bill. **/

#include <fstream>
#include <cmath>
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
double meal_cost;
cout << "Enter meal cost: ";
cin >> meal_cost;

double meal (meal_cost),
tax (.067),
tip (0.2),
tax_total (meal * tax),
subtotal (meal + tax_total),
tip_total (subtotal * tip),
total (subtotal + tip_total);

cout << setprecision(2) << fixed;
cout << left << setw(15) << "Meal:" << right << setw(1) << " $" << setw(6) << meal << endl;
cout << left << setw(15) << "Tax:" << right << setw(1) << " $" << setw(6) << tax_total << endl;
cout << left << setw(15) << "Tip:" << right << setw(1) << " $" << setw(6) << tip_total << endl;
cout << left << setw(15) << "Total:" << right << setw(1) << " $" << setw(6) << total << endl;


return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote