Program that computes tax and tip on a restaurant bill

Hello,

I'm brand new to programming and I'm having trouble with this assignment:

"Write and document a program that computes the tax and tip on a restaurant bill for a group of four (4) people whose meal charges are $88.67. The state sales tax should be 7% of the meal charges and the county tax should be 2% of the meal charges. The tip should be 20% of the total after adding the tax.

Display the following:
1) meal charges
2) state tax amount
3) county tax amount
4) total of the meal charge with the state tax amount
5) total of the meal charge with the state and county tax amount
6) total tip amount
7) total spent (meal charges, taxes and tip included)

Pause at the end with a cin.get() at the end. The "cin.get();" pauses the console interaction and waits until the ENTER key is selected."

So far, I have the following code written:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include "stdfx.h"
using namespace std;

int main ()

{

// Total cost of the bill.
float total;

total = 88.67;
cout << "The total cost of the bill is $ " << totalCost << endl;

// State sales tax rate.
float stateTax;

stateTax = 0.07;
cout << "The state tax rate is  " << stateTax << endl;

// County sales tax amount. 
float countyTax;

countyTax = 0.02;
cout << "The county tax rate is " << countyTax << endl;

// Total of the meal charge with the state tax amount.


I'm unsure if the code I have so far makes sense and I am having trouble figuring out what to do next. My instructor said that we will need at least 6-7 variables. Any advise would be greatly appreciated.
Do something like this.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
float total_StateCost; // variable for total with state tax
total_StateCost=stateTax*total+total;
cout << "The total cost of the meal with state tax is " << total_StateCost << endl;

float total_Tax; // variable for total with all taxes
total_Tax=countyTax*total+stateTax*total+total;

cout << "The cost of the meal with state and county tax is " << total_Tax << endl;

// Tip amount
float tip;
tip=total*.2;

// Meal total
float meal_Total;
meal_Total=tip+total_Tax; 

cout << "The total cost of the meal with all taxes and tip is " << meal_Total << endl;
Topic archived. No new replies allowed.