In: Computer Science
(In python)
Write a function calc_pizza_charge that takes four integer arguments, one for the size (1 small, 2 medium, 3 large), one for the number of meat toppings, one for the number of other toppings and another for the quantity of pizzas ordered. It should calculate and return the total due for that pizza order based on the following information:
Small pizza base price: $6.50
Medium pizza base price: $9.50
Large pizza base price: $11.50
The base pizza price includes one meat and one non-meat topping.
Additional meat toppings are charged at $3.50 each.
Additional non-meat toppings are charged at $1.5 each.
Write a function get_pizza_info that gets from the user the pizza size, meat topping quantity, non-meat topping quantity and number of pizza’s ordered and calls the calc_pizza_charge method and returns the result. Write a program in problem3.py that calls get_pizza_info and prints the result formatted for currency.
Sample run: Enter pizza size (1 small, 2 medium, 3 large): 3
Enter number meat toppings: 2
Enter number or non-meat toppings: 3
Enter number of pizzas ordered: 2
Pizza Total: $36.00
==================================
def
calc_pizza_charge(pizza_size,noOfMeatToppings,otherToppings,noOfPizzas):
if pizza_size==1 :
tot=6.50*noOfPizzas
elif pizza_size==2 :
tot=9.50*noOfPizzas
else:
tot=11.50*noOfPizzas
tot=tot+(noOfMeatToppings*3.50)+(otherToppings*1.50)
return tot;
def get_pizza_info():
size=int(input("Enter pizza size (1 small, 2 medium, 3
large):"))
meatTopp=int(input("Enter number of meat toppings: "))
otherTopp=int(input("Enter number or non-meat toppings: "))
noOfPizzas=int(input("Enter number of pizzas ordered: "))
pizza_total=calc_pizza_charge(size,meatTopp,otherTopp,noOfPizzas)
print('Pizza Total: $%0.2f '%pizza_total,end="")
def main():
get_pizza_info()
if __name__ == "__main__":
main()
===============================
-====================================Thank Yiou