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.
Question
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.
Solution
Here is a Python program that fulfills your requirements:
def get_sales():
sales = float(input("Enter the price 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("The salesperson's commission is: ", commission)
main()
Here's how it works:
- The
get_salesfunction asks the salesperson for the price value of daily sales and returns this figure. - The
calculate_commissionfunction calculates the salesperson’s commission based on the sales figure and the given rates. - The
mainfunction calls theget_salesfunction to get the sales figure, then calls thecalculate_commissionfunction to calculate the commission, and finally prints the commission.
Similar Questions
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
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.
Sales=40,000 variable cost=20% Fixed cost=30000 using Goal Seek analysis find the profit when sales is Rs.80000 Options : 34000 30000 22000 32000 do in excel
Linda is managing a small business and wants to calculate the total revenue based on the sales of two products. The price of the first product is 25 rupees, and the price of the second product is 40 rupees. Write a program that takes the quantity sold for each product as input and outputs the total revenue using arithmetic operators
Fixed cost Rs. 80,000; Variable cost Rs. 2 per unit; Selling price_Rs. 10 per unit; turnover required for a profit target of Rs. 60,000.a.Rs. 1,75,000.b.Rs. 1,86,667.c.Rs. 1.57,000.d.Rs. 1,17,400.
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.