Generation

generate functionThu, 02 Feb 2023

# Write a program that implements the algorithm which determines the monthly wages of a salesperson. Every salesperson has a base salary. The salesperson also receives a bonus at the end of each month, based on the following criteria: If the salesperson has been with the store for five years or less, the bonus is \$10 for each year that he or she has worked there. If the salesperson has been with the store for more than five years, the bonus is \$20 for each year that he or she has worked there. The salesperson can earn an additional bonus as follows: If the total sales made by the salesperson for the month are at least \$5,000 but less than \$10,000, he or she receives a 3% commission on the sale. If the total sales made by the salesperson for the month are at least \$10,000, he or she receives a 6% commission on the sale. To calculate a salesperson’s monthly paycheck, you need to know the base salary, the number of years that the salesperson has been with the company, and the total sales made by the salesperson for that month. Suppose baseSalary denotes the base salary,noOfServiceYears denotes the number of years that the salesperson has been with the store,bonus denotes the bonus, totalSales denotes the total sales made by the salesperson for the month, and additionalBonus denotes the additional bonus.

baseSalary = 2000 noOfServiceYears = 3 bonus = noOfServiceYears * 10 totalSales = 8000 if totalSales >= 5000 && totalSales < 10000 { additionalBonus = totalSales * 0.03 } else if totalSales >= 10000 { additionalBonus = totalSales * 0.06 }