A salesperson gets a yearly bonus based on a commission from collections of sales and review from peers. Sales will be calculated for 12 months and the commission is rated based on an average sales...


A salesperson gets a yearly bonus based on a commission from collections of sales and review  from peers. Sales will be calculated for 12 months and the commission is rated based on an  average sales table (shown in the next page). Other salesperson in the company will give points  for peer review. The average from the peer review determines the review rate.


Write a complete C program based on the above situation and the following instructions.



  1. Declare a
    structure
    of Sales Executive record called
    SalesExecutive
    that has: ∙ Sales Executive name :
    exec_name (string)


∙ Basic salary :
basic_salary (float)


∙ Average sales :
averageSales (float)


∙ Average peer review :
averagePeerReview (float)


∙ Total yearly bonus :
yearlyBonus (float)



  1. In function

    main()

    :


∙ Create a structure variable named
staff


∙ Prompt user to enter sales executive name (exec_name) and his/her basic salary  (basic_salary).


∙ Call function

calc_averageSales ()

to key-in and calculate the average sales  obtained in 12 months. Return the average and store the average sales in
averageSales.


∙ Call function

getCommissionRate (…)

and pass
averageSales
as the parameter to  determine the commission rate. Return the rate.


∙ Next, prompt user to enter number of sales executive in the company.


∙ Call function

calc_AveragePeerReview (…)

and pass the number of the sales  executives as entered earlier. Return the average and store it in
averagePeerReview.


∙ Call function

getReviewRate(…)

and pass
averagePeerReview
as the parameter to  determine the review rate. Return the rate.


∙ Next, calculate the amount of bonus based on commission rate.


∙ Bonus from commission = commission rate X average of sales


∙ Then, calculate the amount of bonus from peer review.


∙ Bonus from peer review = review rate X basic salary


∙ Then, calculate the total bonus of the year by adding the two bonus amounts. ∙ Display all the details of the Sales Executive record as shown in the sample output.










LECTURE EXERCISE – CHAPTER 7
SNK/2020









LECTURE EXERCISE – CHAPTER 7


iii. In function

calc_averageSales ():


∙ Declare a prototype for this function.


∙ Create an array to store the collection of sales for 12 months.


∙ Using
for
loop, prompt the user to enter the collection of sales


∙ Store the input in the array accordingly.


∙ Calculate total of the sales.


∙ Then, calculate the average of the sales.


∙ Return the average sales.



  1. In function

    getCommissionRate(…):



∙ Declare a prototype for this function.


∙ Using
if-else
statements, determine the rate based on the average sales. Refer to  the following table:



























Average Sales (RM)




Commission Rate (%)



Less than 8000



0



8000 - 15000



10



15999 - 20000



15



More than 20000



20









∙ Return the commission rate.



  1. In function

    calc_AveragePeerReview(…):



∙ Declare a prototype for this function.


∙ Create an array to store the peer reviews based on the number of salespersons. ∙ Using
for
loop, prompt the user to enter rating from each peer.


∙ Store the input in the array accordingly.


∙ Calculate total rating of the review.


∙ Then, calculate the average of the peer review rating


∙ Return the average peer rating



  1. In function

    getReviewRate(…):



∙ Declare a prototype for this function.


∙ Using
if-else
statements, determine the rate based on the average rating from  peers. Refer to the following table:



























Average rating




Review Rate (%)



Less than 2.50



0



Less than 3.00



2



Less than 4.00



3.5



4.00 – 5.00



7









∙ Return the review rate.
















SAMPLE OUTPUT 1:<br>Enter the Sales Executive name: Lily<br>Enter the basic salary: RM 2300<br>Enter the sales for 12 months:<br>Sales month 1 = 8000<br>Sales month 2 - 9000<br>Sales month 3 - 10000<br>Sales month 4 = 15000<br>Sales month 5<br>Sales month 6 - 10000<br>Sales month 7<br>Sales month 8<br>- 850<br>7500<br>9800<br>Sales month 9 - 10500<br>Sales month 10 - 10500<br>Sales month 11 - 8000<br>Sales month 12 - 12000<br>%3!<br>Enter the number of sales executives in the company: 4<br>Enter Review Peer 1 = 4.5<br>Enter Review Peer 2 - 4<br>Enter Review Peer 3 - 3.78<br>Enter Review Peer 4 - 3.89<br>.--YEAR 2018 BONUS RECORD-----.<br>Sales Executive name: Lily<br>Basic salary: RM23000.ee<br>Average sales: RM 9262.50<br>Bonus amount from sales:RM 926.25<br>Average rating of peer reviews: 4.04<br>Bonus amount from peer reviews:RM 161.00<br>Total bonus: RM 1087.25<br>

Extracted text: SAMPLE OUTPUT 1: Enter the Sales Executive name: Lily Enter the basic salary: RM 2300 Enter the sales for 12 months: Sales month 1 = 8000 Sales month 2 - 9000 Sales month 3 - 10000 Sales month 4 = 15000 Sales month 5 Sales month 6 - 10000 Sales month 7 Sales month 8 - 850 7500 9800 Sales month 9 - 10500 Sales month 10 - 10500 Sales month 11 - 8000 Sales month 12 - 12000 %3! Enter the number of sales executives in the company: 4 Enter Review Peer 1 = 4.5 Enter Review Peer 2 - 4 Enter Review Peer 3 - 3.78 Enter Review Peer 4 - 3.89 .--YEAR 2018 BONUS RECORD-----. Sales Executive name: Lily Basic salary: RM23000.ee Average sales: RM 9262.50 Bonus amount from sales:RM 926.25 Average rating of peer reviews: 4.04 Bonus amount from peer reviews:RM 161.00 Total bonus: RM 1087.25
Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here