Write a program that calculates the tip and the total cost for a meal. 1. Prompt
ID: 3639423 • Letter: W
Question
Write a program that calculates the tip and the total cost for a meal.1. Prompts the user for the cost of the meal (without tip)
2. Prompts the user for the percentage you want to tip (15 for 15%)
3. If the user's entry is for the tip is zero or positive:
Calculate the tip in dollars, cost of the meal, and total expenditure (cost + tip)
4. Print out the results
5. Repeats the program again (beginning at the prompt)
6. If the user's entry was negative, exit the program
Sample Run - should look like this:
Enter cost of meal: $16.55
Enter tip percentage: 15%
Calculated tip = $2.48
Total Expenditure = $19.03
Enter cost of meal: $-1
Thank you for visiting the Zatoichi Sushi Hut!
Explanation / Answer
The above program is incorrect. It doesn't calculate the total cost correctly. #include using namespace std; int main() { float cost,tipp,tip,total; int i=0; while(i==0) { cout > cost; if(cost>0) { cout > tipp; if(tipp>0) { tip=(cost*tipp)/100; total=cost+tip; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.