Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Modify the answer to Exercise 1 as follows. Jerry will be charging the total bil

ID: 3882867 • Letter: M

Question

Modify the answer to Exercise 1 as follows. Jerry will be charging the total bill, including the tip, to his credit card. Modify the solution so that, in addition to calculating and displaying the appropriate tip, it also calculates and displays the amount charged to Jerry's credit card. Desk-check the algorithm using $50 as the total bill, $5 as the liquor charge, and 20% as the tip percentage. Then desk-check it using $15 as the total bill, $0 as the liquor charge, and 15% as the tip percentage.

Explanation / Answer

For total_bill = $50, liquor_charge = $5 and tip=20%

total_amount = $50 + $5 = $55
tip = 20 * 55 / 100 = $11
SO total amount charged to the card = $55 + $11 = $66

========================================================

For total_bill = $15, liquor_charge = $0 and tip=15%

total_amount = $15 + $0 = $15
tip = 15 * 15 / 100 = $2.25
SO total amount charged to the card = $15 + $2.25 = $17.25

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote