# Constants for the menu choices # Constants for the menu choices PURCHASE_ADULT = 1 PURCHASE_CHILD = 2 PURCHASE_MOUSE_EARS = 3 PURCHASE_PARKING = 4 PURCHASE_FOOD = 5 PRINT_ALL = 6 CALC_TOTAL = 7 QUIT_CHOICE = 8 # The main function. def main(): # The choice variable controls the loop # and holds the user's menu choice.     choice = 0     costAdult=0     costKid=0     costEars=0     costPark=0     costFood = 0     while choice != QUIT_CHOICE: # display the menu.     display_menu() # Get the user's choice.         choice = int(input('Enter your choice: ')) # Perform the selected action.         if choice == PURCHASE_ADULT:                 costAdult = purchaseAdult()                 elif choice == PURCHASE_CHILD:                 costKid = purchaseKid()                 elif choice == PURCHASE_MOUSE_EARS:                 costEars = purchaseEars()                 elif choice == PURCHASE_PARKING:                     costPark = purchaseParking();                     elif choice == PURCHASE_FOOD:                         costFood = purchaseFood()                         elif choice == PRINT_ALL:                             printIt(costAdult,costKid,costEars,costPark,costFood)                             elif choice == CALC_TOTAL:                                 calcTotal(costAdult,costKid,costEars,costPark,costFood)                                 elif choice == QUIT_CHOICE:                                     print('Exiting the program...')                                     else:                                         print('Error: invalid selection.') # The display_menu function displays a menu.     def display_menu():         print(' MENU')         print('1) Purchase adult tickets')         print('2) Purchase child tickets')         print('3) Purchase cool mouse ears')         print('4) Purchase parking')         print('5) Purchase food')         print('6) Print information')         print('7) Calculate total')         print('8) Quit') #purchaseAdult() method returns how much the adult tickets will cost def purchaseAdult():     COST_EACH = 95.00 # finish this #purhcaseKid() function returns how much the kids tickets will cost def purchaseKid():     COST_KID = 65.00 # finish this #purhcaseKid() function returns how much the kids tickets will cost def purchaseEars():     EAR_COST = 9.00 # finish this # purchaseParking() just returns 25 for parking def purchaseParking():     COST_PARKING = 25 #finish this # purchaseFood() asks for the number of hot dogs and sodas, calculates the total cost # and returns this value def purchaseFood():     COST_DOGS = 12     COST_SODA = 6     print("We have hot dogs ($12.00 each) and soda ($6.00 each) only") #printIt() prints our each individual cost (see sample output def printIt(costA, costK, costE, costP, costF):     print() #finish this #calcTotal() calculates and prints the total cost def calcTotal(costA, costK, costE, costP, costF):     print() # finish this # Call the main function. main()

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

# Constants for the menu choices
# Constants for the menu choices
PURCHASE_ADULT = 1
PURCHASE_CHILD = 2
PURCHASE_MOUSE_EARS = 3
PURCHASE_PARKING = 4
PURCHASE_FOOD = 5
PRINT_ALL = 6
CALC_TOTAL = 7
QUIT_CHOICE = 8
# The main function.
def main():
# The choice variable controls the loop
# and holds the user's menu choice.
    choice = 0
    costAdult=0
    costKid=0
    costEars=0
    costPark=0
    costFood = 0
    while choice != QUIT_CHOICE:
# display the menu.
    display_menu()
# Get the user's choice.
        choice = int(input('Enter your choice: '))
# Perform the selected action.
        if choice == PURCHASE_ADULT:
                costAdult = purchaseAdult()
                elif choice == PURCHASE_CHILD:
                costKid = purchaseKid()
                elif choice == PURCHASE_MOUSE_EARS:
                costEars = purchaseEars()
                elif choice == PURCHASE_PARKING:
                    costPark = purchaseParking();
                    elif choice == PURCHASE_FOOD:
                        costFood = purchaseFood()
                        elif choice == PRINT_ALL:
                            printIt(costAdult,costKid,costEars,costPark,costFood)
                            elif choice == CALC_TOTAL:
                                calcTotal(costAdult,costKid,costEars,costPark,costFood)
                                elif choice == QUIT_CHOICE:
                                    print('Exiting the program...')
                                    else:
                                        print('Error: invalid selection.')
# The display_menu function displays a menu.
    def display_menu():
        print(' MENU')
        print('1) Purchase adult tickets')
        print('2) Purchase child tickets')
        print('3) Purchase cool mouse ears')
        print('4) Purchase parking')
        print('5) Purchase food')
        print('6) Print information')
        print('7) Calculate total')
        print('8) Quit')
#purchaseAdult() method returns how much the adult tickets will cost
def purchaseAdult():
    COST_EACH = 95.00
# finish this
#purhcaseKid() function returns how much the kids tickets will cost
def purchaseKid():
    COST_KID = 65.00
# finish this
#purhcaseKid() function returns how much the kids tickets will cost
def purchaseEars():
    EAR_COST = 9.00
# finish this
# purchaseParking() just returns 25 for parking
def purchaseParking():
    COST_PARKING = 25
#finish this
# purchaseFood() asks for the number of hot dogs and sodas, calculates the total
cost
# and returns this value
def purchaseFood():
    COST_DOGS = 12
    COST_SODA = 6
    print("We have hot dogs ($12.00 each) and soda ($6.00 each) only")
#printIt() prints our each individual cost (see sample output
def printIt(costA, costK, costE, costP, costF):
    print()
#finish this
#calcTotal() calculates and prints the total cost
def calcTotal(costA, costK, costE, costP, costF):
    print()
# finish this
# Call the main function.
main()

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 8 images

Blurred answer
Knowledge Booster
ListBox
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education