I am writing a program that computes the tax and tip on a restaurant bill for a patron with a $44.50 meal charge. The tax is 6.75 of the meal cost. The tip is 15 percent of the total after adding the tax. I have to dislay the meal cost, tax amount, tip amount, and total bill on the screen, is my logic right?
#include <iostream>
using namespace std;
int main()
{
//Declare variables
double
subTotal,// charge paid for meal
waitressTotal, //the toal the waitress gets for the meal
totalTax, //total paid
salesTip, //sales tip paid to waitress
grandTotal, //grand total for meal
mealCost; //cost for the entire meal
float tax; //Base sales tax
//Calculate restauraunt bill
subTotal = 44.50;
tax = 6.75;
totalTax;
totalTax = subTotal + tax;
waitressTotal = subTotal + totalTax * 0.15;
grandTotal = subTotal + waitressTotal;
cout<<"The amount for the meal is: $"<<subTotal<<endl;
cout<<endl;
cout<<"The tax amount for the meal is: $"<<totalTax<<endl;
cout<<endl;
cout<<"The tip amount for the meal is: $"<<waitressTotal<<endl;
cout<<endl;
cout<<"The total bill is: $"<<grandTotal<<endl;
cout<<endl;
system("pause");
return 0;
}
Any help is greatly appreciated..