I have a set of different functions that I created and am required to use for a program and I need to figure out how to call them inside one function. Requirements for my code are as follows
The Input processing should only
be done using functions: getPackage, validPackage, getHours,
validHours, and program control constructs.
The Calculation Processing should only be done using functions:
calculatePkg_A, calculatePkg_B, calculatePkg_C, and program control constructs.
For Output Results you should display the Package Selected, Hours of
Usage, and the Amount charged for the month.
getpackage would get an input of A,B,C as an input validPackage would make sure that one of those 3 are selected gettheours would get a float as input valid hours would ensure that the input is between zero and 720 Pkg_A,Pkg_B and Pkg_C are mathematical commands chosen based on the input the user does.
def getPackage(v):
v=str(input("Choose a package. Must be A, B, or C"))
def validPackage(l):
if l != "A" or l!="B" or l!="C":
print("Input must be A,B,C. Please choose a valid package")
def getthehours(z):
z=str(input("Enter a number of hours between 0 and 720"))
def validhours(gethours):
if gethours<0 or gethours>720:
print("Invalid number. Numbers must be between 0 to 720")
else:
print("GOOD HOUR CHOICE")
def calculatepkg_A(hoursprovided):
if hoursprovided<50:
print("Your cost is $15 per month")
elif hoursprovided>50:
x=hoursprovided-50
print((2*x)+15)
def calculatepkg_B(hoursprovided):
if hoursprovided<100:
print("Your cost is $20 per month")
elif hoursprovided>100:
x=hoursprovided-100
print((1.5*x)+20)
def calculatepkg_C(hoursprovided):
if hoursprovided<150:
print("Your cost is $25 per month")
elif hoursprovided>=150:
x=hoursprovided-150
print((1*x)+25)
def main():
n=str(input("Choose a package. Must be A, B, or C"))
l=float(input("Choose a number of hours between 0 and 720"))
getPackage(n)
validhours(l)
if n=="A":
calculatepkg_A(l)
elif n=="B":
calculatepkg_B(l)
elif n=="C":
calculatepkg_C(l)