122k views
1 vote
Optional Bonus Task Follow these steps: Create a Python file called optional_task.py in this folder. Design a program for a department store to calculate the monthly wage for two different types of employees. Employees can either be a salesperson or a manager. Salespeople earn an 8% commission on their gross sales and a fixed salary of R2 000.00 per month. Managers earn an hourly rate of R40.00. Determine if the user is a salesperson or a manager. Then, depending on their answer, calculate the monthly wage for the employee. If the user is a salesperson, ask for their gross sales for the month. If the user is a manager, ask for the number of hours worked for the month. • Display the total monthly wage for the employee.

1 Answer

3 votes

def calculate_salesperson_wage():

sales = float(input("Enter the gross sales for the month: "))

fixed_salary = 2000

commission = 0.08 * sales

total_wage = fixed_salary + commission

print(f"Total monthly wage: R{total_wage:.2f}")

def calculate_manager_wage():

hours_worked = float(input("Enter the number of hours worked for the month: "))

hourly_rate = 40

total_wage = hourly_rate * hours_worked

print(f"Total monthly wage: R{total_wage:.2f}")

employee_type = input("Are you a salesperson or a manager? ")

employee_type = employee_type.lower()

if employee_type == "salesperson":

calculate_salesperson_wage()

elif employee_type == "manager":

calculate_manager_wage()

else:

print("Invalid employee type. Please try again.")

User Jderda
by
7.9k points