I need help with this program:
Create a program that will accept the user's name and ID number. The program will then ask for the department code, 1 is for the Toy Section, 2 for Ladies' Wear, 3 for Men's Wear, and 4 for Kiddie Section. If the user enters 1 (for example), it will show the products on the Toy Selection and their prices. Afterwards, it will ask the user to enter which product they want to buy then the quantity of the product. It will display the total and determine the commission. If the total is less than 5000, then there's no commission. Otherwise, there will be a 10% commission if the total is over 5000, 20% if it's over 10,000 and 30% if the total is 15,000.
Available products in Toy Section:
A - Toy Car Price: 300 B - Stuff Toys Price: 500
Available products in Ladies' Section:
C - Pants Price: 799 D - Blouse Price: 599 E - Underwear Price: 499
Available products in Men's Wear Section:
F - Necktie Price: 249 G - T-shirt Price: 349 H - Belt Price: 199
Available products in Kiddies Section:
I - Milk Bottle Price: 99 J - Walker Price: 899
This is my code:
rep_name = input("Enter Sales' Representative Name: ")
id_number = input("Enter ID Number: ")
department_code = int(input("Enter Department Code: "))
match department_code:
case 1:
department_code = {"Toy"}
priceA = int(300)
priceB = int(500)
for i in department_code:
print("You are in",i,"Section.")
print("Available products in",i,"Section:\nA - Toy Car Price:",priceA,"\nB - Stuff Toys Price:",priceB)
case 2:
department_code = {"Ladies' Wear"}
priceC = int(799)
priceD = int(599)
priceE = int(499)
for i in department_code:
print("You are in",i,"Section.")
print("Available products in",i,"Section:\nC - Pants Price:",priceC,"\nD - Blouse Price:",priceD,"\nE - Underwear Price:",priceE)
case 3:
department_code = {"Men's Wear"}
priceF = int(249)
priceG = int(349)
priceH = int(199)
for i in department_code:
print("You are in",i,"Section.")
print("Available products in",i,"Section:\nF - Necktie Price:",priceF,"\nG - T-shirt Price:",priceG,"\nH - Belt Price:",priceH)
case 4:
department_code = {"Kiddie"}
priceI = int(99)
priceJ = int(899)
for i in department_code:
print("You are in",i,"Section.")
print("Available products in",i,"Section:\nI - Milk Bottle Price:",priceI,"\nJ - Walker Price:",priceJ)
case _:
print("Code is incorrect!")
# total amount <5000 = no commission
# total amount >=5000 = 10% commission
# total amount >= 10000 = 20% commission
# total amount >= 15000 = 30% commission
product = input("Enter product: ")
match department_code and product:
case 1 | 'a' | 'A':
commission = float(0)
quantity = int(input("Quantity: "))
totalAmount = int(quantity * priceA)
print("Total Amount:",totalAmount)
if (totalAmount >=5000) and (totalAmount <=9999):
commission = totalAmount*0.1
print("commission:", "%.2f" % commission)
elif (totalAmount >=10000) and (totalAmount <=14999):
commission = totalAmount*0.2
print("commission:", "%.2f" % commission)
elif (totalAmount >=15000):
commission = totalAmount*0.3
print("commission:", "%.2f" % commission)
else:
print("commission:", int(commission))
case 1 | 'b' | 'B':
commission = float(0)
quantity = int(input("Quantity: "))
totalAmount = int(quantity * priceB)
print("Total Amount:",totalAmount)
if (totalAmount >=5000) and (totalAmount <=9999):
commission = totalAmount*0.1
print("commission:", "%.2f" % commission)
elif (totalAmount >=10000) and (totalAmount <=14999):
commission = totalAmount*0.2
print("commission:", "%.2f" % commission)
elif (totalAmount >=15000):
commission = totalAmount*0.3
print("commission:", "%.2f" % commission)
else:
print("commission:", int(commission))
case 2 | 'c' | 'C':
commission = float(0)
quantity = int(input("Quantity: "))
totalAmount = int(quantity * priceC)
print("Total Amount:",totalAmount)
if (totalAmount >=5000) and (totalAmount <=9999):
commission = totalAmount*0.1
print("commission:", "%.2f" % commission)
elif (totalAmount >=10000) and (totalAmount <=14999):
commission = totalAmount*0.2
print("commission:", "%.2f" % commission)
elif (totalAmount >=15000):
commission = totalAmount*0.3
print("commission:", "%.2f" % commission)
else:
print("commission:", int(commission))
case 2 | 'd' | 'D':
commission = float(0)
quantity = int(input("Quantity: "))
totalAmount = int(quantity * priceD)
print("Total Amount:",totalAmount)
if (totalAmount >=5000) and (totalAmount <=9999):
commission = totalAmount*0.1
print("commission:", "%.2f" % commission)
elif (totalAmount >=10000) and (totalAmount <=14999):
commission = totalAmount*0.2
print("commission:", "%.2f" % commission)
elif (totalAmount >=15000):
commission = totalAmount*0.3
print("commission:", "%.2f" % commission)
else:
print("commission:", int(commission))
case 2 | 'e' | 'E':
commission = float(0)
quantity = int(input("Quantity: "))
totalAmount = int(quantity * priceE)
print("Total Amount:",totalAmount)
if (totalAmount >=5000) and (totalAmount <=9999):
commission = totalAmount*0.1
print("commission:", "%.2f" % commission)
elif (totalAmount >=10000) and (totalAmount <=14999):
commission = totalAmount*0.2
print("commission:", "%.2f" % commission)
elif (totalAmount >=15000):
commission = totalAmount*0.3
print("commission:", "%.2f" % commission)
else:
print("commission:", int(commission))
case 3 | 'f' | 'F':
commission = float(0)
quantity = int(input("Quantity: "))
totalAmount = int(quantity * priceF)
print("Total Amount:",totalAmount)
if (totalAmount >=5000) and (totalAmount <=9999):
commission = totalAmount*0.1
print("commission:", "%.2f" % commission)
elif (totalAmount >=10000) and (totalAmount <=14999):
commission = totalAmount*0.2
print("commission:", "%.2f" % commission)
elif (totalAmount >=15000):
commission = totalAmount*0.3
print("commission:", "%.2f" % commission)
else:
print("commission:", int(commission))
case 3 | 'g' | 'G':
commission = float(0)
quantity = int(input("Quantity: "))
totalAmount = int(quantity * priceG)
print("Total Amount:",totalAmount)
if (totalAmount >=5000) and (totalAmount <=9999):
commission = totalAmount*0.1
print("commission:", "%.2f" % commission)
elif (totalAmount >=10000) and (totalAmount <=14999):
commission = totalAmount*0.2
print("commission:", "%.2f" % commission)
elif (totalAmount >=15000):
commission = totalAmount*0.3
print("commission:", "%.2f" % commission)
else:
print("commission:", int(commission))
case 3 | 'h' | 'H':
commission = float(0)
quantity = int(input("Quantity: "))
totalAmount = int(quantity * priceH)
print("Total Amount:",totalAmount)
if (totalAmount >=5000) and (totalAmount <=9999):
commission = totalAmount*0.1
print("commission:", "%.2f" % commission)
elif (totalAmount >=10000) and (totalAmount <=14999):
commission = totalAmount*0.2
print("commission:", "%.2f" % commission)
elif (totalAmount >=15000):
commission = totalAmount*0.3
print("commission:", "%.2f" % commission)
else:
print("commission:", int(commission))
case 4 | 'i' | 'I':
commission = float(0)
quantity = int(input("Quantity: "))
totalAmount = int(quantity * priceI)
print("Total Amount:",totalAmount)
if (totalAmount >=5000) and (totalAmount <=9999):
commission = totalAmount*0.1
print("commission:", "%.2f" % commission)
elif (totalAmount >=10000) and (totalAmount <=14999):
commission = totalAmount*0.2
print("commission:", "%.2f" % commission)
elif (totalAmount >=15000):
commission = totalAmount*0.3
print("commission:", "%.2f" % commission)
else:
print("commission:", int(commission))
case 4 | 'j' | 'J':
commission = float(0)
quantity = int(input("Quantity: "))
totalAmount = int(quantity * priceJ)
print("Total Amount:",totalAmount)
if (totalAmount >=5000) and (totalAmount <=9999):
commission = totalAmount*0.1
print("commission:", "%.2f" % commission)
elif (totalAmount >=10000) and (totalAmount <=14999):
commission = totalAmount*0.2
print("commission:", "%.2f" % commission)
elif (totalAmount >=15000):
commission = totalAmount*0.3
print("commission:", "%.2f" % commission)
else:
print("commission:", int(commission))
case _:
print("Invalid input.")
This is the output of my code:
Enter Sales' Representative Name: Shane
Enter ID Number: 24
Enter Department Code: 3
You are in Men's Wear Section.
Available products in Men's Wear Section:
F - Necktie Price: 249
G - T-shirt Price: 349
H - Belt Price: 199
Enter product: g
Quantity: 56
Total Amount: 19544
Commission: 5863.20
How can I improve my code?