The program at the end should ask: How much was the meal? 44.50. the it should calculate the tax (.065) , calculate the tip (.15 of meal + tax) and calculate the total cost. Here's my program: // This program asks the cost of the meal, calculates the tax, the tip and the total restaurant bill.

#include <iostream>

using namespace std;

int main()

{

double meal = 44.50; // meal

double tax = .0675*meal; // tax

double tip = .15*(meal+tax); // tip

double total = meal + tax + tip; // total

tax; //computed tax

tip; //computed tip

total; //computed total// Get the cost of the meal.

cout << "How much was the meal? ";

cin >> meal;// Get the tax.

cout << "What was the tax? ";

cin >> tax;// Calculate the tax.

tax = meal*.0675 ;// Get the tip.

cout << "What was the tip? ";

cin >> tip;// Calculate the tip.

tip = (meal+tax)*.15 ;// Get the total amount.

cout << "What was the total amount? ";

cin >> total;// Calculate the total.

total = meal + tax + tip;// Display the meal charge. << "The meal charge $" << meal <<;endl;

// Display the tax charge. <<"The tax charge $" << tax << endl;

// Display the tip charge. <<"The tip charge $" << tip << endl;

// Display the total. <<"The total amount spent $" << total << endl;

return 0;}

Where did I go wrong? JJH - FL

Well, you ask for the answer to what your program is going to compute, that's your first problem. You also calculate the values, but never bother printing them out, so that's your second problem.

There's some other problems that won't affect the final answer, but could be prevented by sitting down and having someone ask you, "What does this line do?" for every line.

Thanks Razor 2.3. I was suspecting that instead of computing the tax, tip & total, I was asking was it was.

I will make the necessay corrections.

Thnaks again for the feedback.

JJH - FL

Ask Your Question

Weekly Poll

Do you think ride and car sharing are the future of transportation?

Discuss in The Lounge

Poll History