Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I tried to run this code in python, and I am expecting the following output. I am getting no prompts or output when I try

I tried to run this code in python, and I am expecting the following output. I am getting no prompts or output when I try to run this code.
Program Output (with input shown in bold) Enter the monthly sales: 14650.00 Enter the amount of advanced pay, or enter 0 if no advanced pay was given. Advanced pay: 1000.00 The pay is $758.00.
Program Output (with input shown in bold) Enter the monthly sales: 9000.00 Enter the amount of advanced pay, or enter 0 if no advanced pay was given. Advanced pay: 0 The pay is $900.00.
Program Output (with input shown in bold) 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.
The code that I am attempting to run is below
### START OF CODE
# This program calculates a salesperson's pay
# at make your own music
def main():
# get the amount of sales
sales = get_sales()
# get the amount of advanced pay
advanced_pay = get_advanced_pay()
# Determine the commission rate
comm_rate = determine_comm_rate(sales)
# calc pay
pay = sales * comm_rate - advanced_pay
# display the amount of pay
print(f'The pay is ${pay:,.2f}.')
# determine whether the pay is negative
if pay <0:
print('The salesperson must reimburse')
print('the company')
# the get_sales function gets a salesperson's
# monthly sales from the user and returns that value
def get_sales():
# get the amount of monthly sales
monthly_sales = float(input('Enter the monthly sales: '))
# Return the amount entered
return monthly_sales
# The get_advanced pay function gets the amount of
# advanced pay given to the salesperson and returns
# that amount
def get_advanced_pay():
# get the amount of advanced pay
print('Enter the amount of advanced pay, or')
print('enter 0 if no advanced pay was given.')
advanced = float(input('Advanced pay: '))
# return amount entered
return advanced
# The determine_comm_rate function accepts the
# amount of sales as an argument and returns the
# applicable commission rate.
def determine_comm_rate(sales):
# determine the commission rate
if sales <10000.00:
rate =0.10
elif sales >=10000 and sales <=14999.99:
rate =0.12
elif sales >=15000 and sales <=17999.99:
rate =0.14
elif sales >=18000 and sales <=21999.99:
rate =0.16
else:
rate =0.18
# return the comm rate
return rate
### END OF CODE

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

Explain the service recovery paradox.

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago