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

Python Break down into functions Break down into functions The Casewell Catering

ID: 3703688 • Letter: P

Question

Python Break down into functions Break down into functions The Casewell Catering and Convention Service have asked you to write a computer program to produce customer's bill. The program should read in the following data. s a. The number of adults to be served. 2 b. The number of children to be served 9 c. The cost per adult's meal. unthon d. The cost per child's meal (60% of the cost of adult's meal)·ruhinn 5 e. The cost for dessert (same for adults and children), punch? b f. The room fee. unchn 1 g. A percentage for tip and tax (not applicable to room fee). E inpnt s h. Any deposit should be deducted from the room fee. You program will produce following output Casewell Catering and Convention Service Final Bill Number of Adults: 23 Number of Children: 7 Cost per adult without dessert: Cost per child without dessert: Cost per dessert: Room fee: Tip and tax rate: 12.75 S 7.65 $ 1.00 S 45.00 0.18 Total cost for adult meals: Total cost for child meals: Total cost for dessert: Total food cost: Plus tips and tax: Plus room fee Less deposit S 239.25 S 53.55 S 30.00 $ 376.80 S 67.82 S 45.00 S 50.00 Balance due: S 439.62

Explanation / Answer

# import only system from os
import os
  
adults = input(" The no. of adults to be served? ")

children = input(" The no. of children to be served? ")

adult_meal_cost = input(" The cost per adult's meal? ")

#child_meal_cost_function
def child_meal_cost( cost ):
return (cost * 60)/100

desert_cost = input(" The cost per dessert? ")

room_fee = input(" The room fee? ")

tip_tax = input(" The percentage for tip and tax? ")

deposit = input(" Deposit, if any? ")

#os.system('cls') #windows
#os.system('clear') #linux

print " Casewell Convention and Catering Service"
print " Final Bill "


print " No. of Adults: ", adults
print " No. of Children: ", children
print " Cost per adult without desert: $", adult_meal_cost
ch_meal_cost = child_meal_cost(adult_meal_cost)
print " Cost per child without desert: $",
print " Cost per dessert: $", desert_cost
print " Room fee: $", room_fee
print " Tip and tax rate: $", tip_tax
print " "

v1 = adults * adult_meal_cost
print " Total cost for adult meals : $", v1

v2 = children * ch_meal_cost
print " Total cost for child meals : $", v2

v3 = (adults + children) * desert_cost
print " Total cost for dessert : $ %.2f"% v3

v4 = v1 + v2 + v3
print " Total food cost : $%.2f"% v4

v5 = v4 * tip_tax
print " plus tip and tax : $%.2f"% v5
bill = v4 + v5

print " plus room fee : $%.2f"% room_fee
bill = bill + room_fee

print " less deposit : $%.2f"% deposit
bill = bill - deposit

print " Balance due : $%.2f"% bill