Problem:
The Caswell Catering and Convention Service has asked you to write a computer program to produce customer bills. The program should read in the following data from the user:
* Number of Meals
* Cost of a Meal
* Cost of a Dessert
* Room Fee
* Deposit
The following information is given:
* Tax rate is 8%
* Tip rate is 15%
Calculate the following costs:
* Total Cost for Meals
* Total Cost for Dessert (every meal will receive a dessert)
* Total Food Cost (cost for meals and costfor desserts)
* Total Tax (based on food cost)
* Total Tip (based on food cost)
* Balance Due (total food cost, total tax, total tip, room fee – less any deposit)
Display a bill to the screen that shows a heading ("Caswell Catering and Convention Service") along with a detailed listing of all of the user data, costs and balance due (13 items). Be sure your output is neatly lined up using appropriate setw and setprecision.
Algorithm:
This is what I have so far…
1. Get information from user
A.Number of Meals
B.Cost of a Meal
C.Cost of a Dessert
D.Room Fee
E.Deposit
2. Calculate the sum.
????
3.Calculate tax.
a. tax = sum * .08
4. Calculate tip.
a. tip = sum * .15
3. Display results
1. Get information from user
A. Number of Meals = int numMeals
B. Cost of a Meal = float costMeal
C. Cost of a Dessert = float costDessert
D. Room Fee = float costRoom
E. Deposit = float deposit
2. Calculate the total cost for the meals
float totalMealCost = numMeals * costMeal.
3. Calculate the total cost for the desserts
float totalDessertCost = numMeals * costDessert
4. Calculate the total food cost
float totalFoodCost = totalMealCost + totalDessertCost
5. Calculate the total tax
float tax = .08 * totalFoodCost
6. Calculate the total tip
float tip = .15 * totalFoodCost
7. Calculate the balance due
balanceDue = totalFoodCost + tax + tip + costRoom – deposit
8. Display all results, nicely ordered
November 14th, 2009 at 9:32 am
1. Get information from user
A. Number of Meals = int numMeals
B. Cost of a Meal = float costMeal
C. Cost of a Dessert = float costDessert
D. Room Fee = float costRoom
E. Deposit = float deposit
2. Calculate the total cost for the meals
float totalMealCost = numMeals * costMeal.
3. Calculate the total cost for the desserts
float totalDessertCost = numMeals * costDessert
4. Calculate the total food cost
float totalFoodCost = totalMealCost + totalDessertCost
5. Calculate the total tax
float tax = .08 * totalFoodCost
6. Calculate the total tip
float tip = .15 * totalFoodCost
7. Calculate the balance due
balanceDue = totalFoodCost + tax + tip + costRoom – deposit
8. Display all results, nicely ordered
References :