👤

Use CodeHs (Python 3)

You have been hired by the state of NC to create a new app to calculate social distancing capacities for movie theaters, outdoor entertainment venues and amusement parks to calculate the MAXIMUM number of patrons they can now host.


Large outdoor venues with seating greater than 10,000 may operate with 7% occupancy for spectators.

Smaller outdoor entertainment venues, like arenas or amphitheaters, may operate outdoors at 30% of outdoor capacity, or 100 guests, whichever is less.

Movie theaters and conference centers may open indoor spaces to 30% of capacity, or 100 guests, whichever is less.

Amusement parks may open at 30% occupancy, outdoor attractions only.

They have very specific requirements for the program so please read the requirements below carefully and using what we have covered so far in Python, create their program. The program MUST NOT crash during runtime or you will not receive the contract. You may use the demo program here to test your program's functionality

PROGRAM REQUIREMENTS

Add the 3 program comments at the top of the program with the information needed:
Name:
Date:
Program:
Define a function named calcCapacity that takes two parameters for the venue type and current (old) maximum capacity. The function will be called with the correct data in the main part of our program, so there is no need to convert any data types within the function. The function will perform the following:

If the venue is L (large), then return the current max capacity times 7%

If the venue is either S (small) or M (movie), then return the smaller of either current maximum capacity times 30% or 100.

If the venue is P (amusement Parks), then return the current maximum capacity times 30%.

For any other venue type print that an invalid venue was entered and return 0.
OUTSIDE the function: Get the user input for the venue type. This must be a single letter - either L, S, M or P. Look at my prompt for a hint on how to structure yours.
Get the user input for the current maximum capacity. Again, see my prompt for a hint.
Print a blank line.
Inside a try block perform the following:

Since the user should only enter 1 letter for the venue, we will test to see if the length of what they entered for the venue is EXACTLY 1 character. Write the following line of code next since we have not officially learned the len( ) function yet. Replace yourVariableForVenue with the name of the variable you used for the venue type.
if len(yourVariableForVenue) != 1:

if the above is True, then display a message indicating the user should only enter 1 letter for the venue type.

Else if the current maximum capacity is negative, then display that the current maximum capacity must be positive.

Else if the venue type is L and the current maximum capacity is less than or equal to 10000, display a message indicating that the large venue capacity must be more than 10000.

Else if the venue type is either M or S and current maximum capacity is greater than 10000, display a message stating that small or movie theater venues maximum current capacity cannot exceed 10000.

Else (now we will do our regular processing and the remainder of the program.)

Make sure the the current maximum capacity is changed to an integer

Call the calcCapacity function using the venue type and current maximum capacity as arguments and store its return value in a variable.

If the returned value is positive, then display a message that tells the user their new maximum capacity. Don't display anything if the returned value is not positive.
Create an except block that will catch the error that will occur if the user enters a non integer for the current maximum capacity. Remember that Python will catch the error because you are casting the value inside the try block.

Display a message to the user in this block that tells them to enter a positive integer for the current maximum capacity.
Create a general exception block that will display a message to the user that another error occurred.
Create a finally block that prints a blank line and then displays another line that thanks the user for using our software.
When you test your program and run the demo use the following values and note the output: ALL should end with the blank line and the thank you message.

L and 12000 should return max capacity is 840

S and 3000 should return max capacity is 100

M and 200 should return max capacity is 60

P and 20000 should return max capacity is 6000

R and any number should return the invalid venue message

L and 5000 should return the large venue cap should be > 10000 message

S and 11000 should return the small venue cap should be < = 10000 message

M and 23000 should return the small venue cap should be <= 10000 message

Movie and any number should return the enter only 1 letter for venue message

L and 1.5 should return the enter positive integer for capacity message

M and M should return the enter positive integer for capacity message

Please Help