Q3) Write a
program that computes the tax and tip on a restaurant bill for a patron with a
$44.75 meal charge. The tax should be 6.75 percent of the meal cost. The tip
should be 15 percent of the total after adding the tax. Display the meal cost,
tax amount, tip amount and total bill on the screen.
#include <iostream>
using namespace std;
int main()
{
double meal_cost,tax,new_bill,tip,total_bill;
meal_cost=44.75;
cout<<"Meal cost = "<<meal_cost<<endl;
{
tax=6.75/100*44.75;
}
cout<<"tax = "<<tax<<endl;
{
new_bill = meal_cost + tax;
}
{
tip = (new_bill/100)*15;
}
cout<<"tip = "<<tip<<endl;
{
total_bill= tax + meal_cost + tip;
}
cout<<"total bill = "<<total_bill<<endl;
return 0;
}
No comments:
Post a Comment