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.  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)  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.  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.  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  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.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

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:
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
Transcribed Image 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
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 6 images

Blurred answer
Knowledge Booster
Structure chart
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education