Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //CIS22A_Lab2_KevinKim
- //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;
- #include <iomanip>
- int main()
- {
- double meal_cost = 44.50,
- tax = 0.0675,
- tip = .15;
- double tax_MC,
- bill,
- tip_TB,
- total_bill;
- //Tax
- tax_MC = meal_cost * tax;
- //Meal
- bill = tax_MC + meal_cost;
- //Tip
- tip_TB = bill * tip;
- //Total
- total_bill = bill + tip_TB;
- //Results
- cout << fixed;
- cout << "The meal cost was $" << meal_cost << " without tax" << setprecision(2) << endl << endl;
- cout << "The tax for the meal cost was $" << tax_MC << setprecision(2) << endl << endl;
- cout << "The tip was $" << tip_TB << setprecision(2) << endl << endl;
- cout << "The total cost was $" << total_bill << setprecision(2) << endl << endl;
- cout << fixed;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement