Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Write a program that computes the tax and tip on a restaurant bill for a patron with a
- //$44.50 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 = 44.50,
- tax = 0.0675,
- tip = .15;
- int Tax_MC,
- bill,
- total_bill,
- Tip_TB;
- //Calculate the tax of the meal cost
- Tax_MC = meal_cost * tax;
- //Calculate the amount of the bill
- bill = Tax_MC + meal_cost;
- //Calculate the cost of the tip from bill
- Tip_TB = bill * tip;
- //Calculate the total amount of the bill plus tip
- total_bill = bill + Tip_TB;
- //Display the results
- cout << "The meal cost was $" << meal_cost << " without tax" << endl << endl;
- cout << "The tax amount of the meal cost was $" << Tax_MC << endl << endl;
- cout << "The tip was $" << Tip_TB << endl << endl;
- cout << "The amount of the bill plus tip was $" << total_bill << endl << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement