87.8k views
1 vote
Default parameters Calculatespiting a check between diners Write a split_check function that returns the amount that each diner must pay to cover the cost of the meal The function has 4 parameters

A.bill The amount of the bill.
B. people. The number of diners to split the bill between tax_percentage.
C.The extra tax percentage to add to the bill . tip percentage:
D.The extra tip percentage to add to the bill.

1 Answer

3 votes

Final answer:

To calculate the total amount per person including tax and tip, add the tax to the bill, add the tip to the subtotal, and divide by the number of diners.

Step-by-step explanation:

The student is asking how to calculate the total amount owed per person after splitting a restaurant check that includes tax and tip. To do this, we need to first add the tax to the bill, then add the tip to the subtotal (which now includes tax), and then divide by the number of diners to find out how much each diner owes.

For example, if the bill is $47.50, the sales tax is 6%, and the group wants to leave an 18% tip, we would calculate the total cost as follows:

Calculate the tax: $47.50 x 6% = $2.85

Add the tax to the bill: $47.50 + $2.85 = $50.35

Calculate the tip: $50.35 x 18% = $9.06

Add the tip to the subtotal: $50.35 + $9.06 = $59.41

Finally, if the bill is to be split between, for example, 4 diners, we would divide the total by 4: $59.41 / 4 = $14.85 per diner.

User Akarsakov
by
8.2k points