Knowee
Questions
Features
Study Tools

IPS_6Write a program that includes two functions. The first function should ask a salesperson for the price value of daily sales and then return this figure to the main program. The second function should calculate the salesperson’s commission based on the following rates:Sales (in rs)commission0-9993%1000-29993.5%3000- up4.5%The calculated commission should be returned to the main program, which then displays it. Output:Enter the dollar value of daily sales: $1500Commission for the day: $52.50

Question

IPS_6Write a program that includes two functions. The first function should ask a salesperson for the price value of daily sales and then return this figure to the main program. The second function should calculate the salesperson’s commission based on the following rates:Sales (in rs)commission0-9993%1000-29993.5%3000- up4.5%The calculated commission should be returned to the main program, which then displays it. Output:Enter the dollar value of daily sales: 1500Commissionfortheday:1500Commission for the day: 52.50

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

Here is a Python program that fulfills your requirements:

def get_sales():
    sales = float(input("Enter the dollar value of daily sales: $"))
    return sales

def calculate_commission(sales):
    if sales <= 999:
        commission = sales * 0.03
    elif sales <= 2999:
        commission = sales * 0.035
    else:
        commission = sales * 0.045
    return commission

def main():
    sales = get_sales()
    commission = calculate_commission(sales)
    print("Commission for the day: $", format(commission, '.2f'))

main()

This program works as follows:

  1. The main() function is called.
  2. Inside main(), the get_sales() function is called, which asks the user to input the dollar value of daily sales and returns this value.
  3. The returned value is stored in the sales variable.
  4. The calculate_commission(sales) function is then called with sales as the argument. This function calculates the commission based on the sales value and returns the commission.
  5. The returned commission is stored in the commission variable.
  6. Finally, the commission is printed out with 2 decimal places.

This problem has been solved

Similar Questions

Write a program that includes two functions. The first function should ask a salesperson for the price value of daily sales and then return this figure to the main program. The second function should calculate the salesperson’s commission based on the following rates:Sales (in rs)commission0-9993%1000-29993.5%3000- up4.5%The calculated commission should be returned to the main program, which then displays it. Output:Enter the dollar value of daily sales: $1500Commission for the day: $52.50

A salesman gets a commission of 5% on the sales he makes if his sales is below Rs.5000/- and a commission of 8% on the sales that exceeds Rs.5000/- or equal to 5000 together with Rs.250/-.Write an algorithm or a flowchart and develop C program for computing the commission of the salesman, given his sales.

A salesman is paid a basic salary of Sh 7100. He also gets 6% commission once he has sold goods for over Sh 70000. How much commission did he earn in a month in which he sold goods worth Sh 560000?

Sales Rs. 50,000; Variable cost Rs. 30,000; Net profit Rs. 6,000; fixed cost is .a.Rs. 12,000.b.Rs. 10,000.c.b. Rs. l4,000 .d.Rs. 8,000.

A grocer has a sale of Rs. 6435, Rs. 6927, Rs. 6855, Rs. 7230 and Rs. 6562 for 5 consecutive months. How much sale must he have in the sixth month so that he gets an average sale of Rs. 6500?Rs. 4991Rs. 5991Rs. 6001Rs. 6991

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.