Advertisement
Guest User

Untitled

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