The program asks the user if they have preregistered for art show tickets. If the user has preregistered, the program should call a function named discount() that displays the message "You are preregistered and qualify for a 5% discount." If the user has not preregistered, the program should call a function named noDiscount() that displays the message "Sorry, you did not preregister and do not qualify for a 5% discount." The source code file provided for this lab includes the necessary input statement. Comments are included in the file to help you write the remainder of the program.

Respuesta :

Answer:

The program is written in Python.

  1. def discount():
  2.    print("You are preregistered and qualify for a 5% discount.")
  3. def noDiscount():
  4.    print("Sorry, you did not preregister and do not qualify for a 5% discount.")
  5. print("Have your preregistered for art show tickets:")
  6. user_input = input("Y (Yes)  or N (No): ")
  7. if(user_input == 'Y'):
  8.    discount()
  9. else:
  10.    noDiscount()

Explanation:

We start with defining two simple functions, discount() (Line 1-2) and noDiscount() (Line 4-5). The two function are just to print a simple message as required by the question.

Next, in the main program (Line 8 - 14), prompt the user for the input either Y (Yes) or N (No) to check if they have pre-registered the art show tickets (Line 8 -9).

If user_input is "Y", call the discount() function else, call noDiscount() function (Line 11- 14). The message defined in each function will be printed accordingly.