Advertisement
Guest User

Untitled

a guest
Apr 30th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. //Write a program that computes the tax and tip on a restaurant bill for a patron with a
  2. //$44.50 meal charge. The tax should be 6.75 percent of the meal cost. The tip should
  3. //be 15 percent of the total after adding the tax. Display the meal cost, tax amount, tip
  4. //amount, and total bill on the screen.
  5.  
  6. #include <iostream>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12. double meal_cost = 44.50,
  13. tax = 0.0675,
  14. tip = .15;
  15.  
  16. int Tax_MC,
  17. bill,
  18. total_bill,
  19. Tip_TB;
  20.  
  21. //Calculate the tax of the meal cost
  22. Tax_MC = meal_cost * tax;
  23.  
  24. //Calculate the amount of the bill
  25. bill = Tax_MC + meal_cost;
  26.  
  27. //Calculate the cost of the tip from bill
  28. Tip_TB = bill * tip;
  29.  
  30. //Calculate the total amount of the bill plus tip
  31. total_bill = bill + Tip_TB;
  32.  
  33. //Display the results
  34.  
  35. cout << "The meal cost was $" << meal_cost << " without tax" << endl << endl;
  36.  
  37. cout << "The tax amount of the meal cost was $" << Tax_MC << endl << endl;
  38.  
  39. cout << "The tip was $" << Tip_TB << endl << endl;
  40.  
  41. cout << "The amount of the bill plus tip was $" << total_bill << endl << endl;
  42.  
  43. system("pause");
  44.  
  45. return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement