Question
PYTHON l functions must include docstrings. Programs with functions must have the statement if __name__==__main__ The main() function is provided, write the functions that are
PYTHON
l functions must include docstrings. Programs with functions must have the statement
if __name__==__main__
The main() function is provided, write the functions that are called in the main() function to
produce these outputs.
>>>
========== RESTART: E:/IVC/CS10 Python/Labs/lab 03-4_commission.py ==========
Enter the monthly sales: 14550.00
Enter the amount of advanced pay, or
enter 0 if no advanced pay was given.
Advanced pay: 1000.00
The pay is $746.00
>>>
========== RESTART: E:/IVC/CS10 Python/Labs/lab 03-4_commission.py ==========
Enter the monthly sales: 9500
Enter the amount of advanced pay, or
enter 0 if no advanced pay was given.
Advanced pay: 0
The pay is $950.00
>>>
========== RESTART: E:/IVC/CS10 Python/Labs/lab 03-4_commission.py ==========
Enter the monthly sales: 12000.00
Enter the amount of advanced pay, or
enter 0 if no advanced pay was given.
Advanced pay: 2000.00
The pay is $-560.00
The salesperson must reimburse
the company.
>>>
# This program calculates a salesperson's pay
def main():
# Get the amount of sales from user
sales = get_sales()
# Get the amount of advanced pay from user.
advanced_pay = get_advanced_pay()
# Determine the commission rate.
comm_rate = determine_comm_rate(sales)
# Calculate the pay.
pay = sales * comm_rate - advanced_pay
# Display the amount of pay.
print('The pay is $', format(pay, ',.2f'), sep='')
# Determine whether the pay is negative.
if pay < 0:
print('The salesperson must reimburse')
print('the company.')
Requirements for the function - determine_comm_rate()
rate
Sales less than 10000.00 .10
Sales from 10000.00 to 14999.99 .12
Sales from 15000.00 to 17999.99 .14
Sales from 18000.00 to 21999.99 .16
Sales greater than 21999.99 .18
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started