Hello, I need to write a program: Enter meal cost: Enter tax (in percentage) Ent
ID: 3628357 • Letter: H
Question
Hello, I need to write a program:
Enter meal cost:
Enter tax (in percentage)
Enter tip (in percentage)
Bill Summary:
Meal cost
Tax amount
Tip amont
Total bill
Okay this what I came up with but it's not compiling...what am I doing wrong?
#include
using namespace std;
int main()
{
double mealCost,
taxAmount,
tipAmount,
roundAmount, subTotal, finalAmount, totalBill;
cout << "Enter the meal cost" << endl;
cin >> mealCost;
cout << "Enter the tax amount" << endl;
cin >> taxAmount;
cout << "Enter the tip amount" << endl;
cin >> tipAmount;
//Calculate meal cost with 8.25% tax amount.
roundAmount = mealCost * taxAmount;
//Calulate the sum total with the round amount and meal cost.
subTotal = mealCost + roundAmount;
finalAmount = subTotal * tipAmount;
//Calculate the total bill with subtotal and final amount.
totalBill = subTotal + finalAmount;
//Display the bill summary.
cout <<
cout <<
cout <<
cout <<
return
}
Explanation / Answer
please rate - thanks
I fixed the spacing (put all instructions on there own line)
you were missing a " on the last cout
#include <iostream>
using namespace std;
int main()
{
double mealCost,
taxAmount,
tipAmount,
roundAmount, subTotal, finalAmount, totalBill;
cout << "Enter the meal cost" << endl;
cin >> mealCost;
cout << "Enter the tax amount" << endl;
cin >> taxAmount;
cout << "Enter the tip amount" << endl;
cin >> tipAmount;
//Calculate meal cost with 8.25% tax amount.
roundAmount = mealCost * taxAmount;
//Calulate the sum total with the round amount and meal cost.
subTotal = mealCost + roundAmount;
finalAmount = subTotal * tipAmount;
//Calculate the total bill with subtotal and final amount.
totalBill = subTotal + finalAmount;
//Display the bill summary.
cout <<"The meal cost is"<< mealCost << endl;
cout <<"The tax amount is" << taxAmount << endl;
cout <<" The tip amount is" << tipAmount << endl;
cout <<"The total bill "<< totalBill << endl;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.