Answer:
Following are the program in the C programming Language:
#include <stdio.h> //header file
//set function for sales
int get_sales(){
int sale;
//print message
printf("Enters monthly sale: ");
scanf("%d",&sale);
return sale;
}
//set function for the advance payment
int get_advanced_pay(){
int advance;
//print message
printf("Enter the amount of advanced pay or enter 0 if no advanced pay was given: ");
scanf("%d",&advance);
return advance;
}
//set fucntion of comman rates
float determine_comm_rate(int sale){
if(sale<10000)
return 0.1;
if(sale<15000)
return 0.12;
if(sale<18000)
return 0.14;
if(sale<22000)
return 0.16;
else
return 0.18;
}
//set the main function
int main(){
int sale,advanced;
float comm_rate,pay;
sale=get_sales();
advanced=get_advanced_pay();
comm_rate=determine_comm_rate(sale);
pay=sale*comm_rate-advanced;
printf("The pay is %f\\",pay);
if(pay<0)
//if the pay is less than 0
printf("The salesperson must reimburse the company");
}
Output:
Enters monthly sale: 45000
Enter the amount of advanced pay or enter 0 if no advanced paywas given: 1000
The pay is 7100.000488
Step-by-step explanation:
Here, we set the integer type function "get_sales()" in which we get the monthly sale of the person and then return sales.
- Then, we set the function "get_advanced_pay()" in which we get the advance payment of the person and then return it.
- Then, we set the function "determine_comm_rate()" in which we compare their sales and return it.
Finally, we set the main method in which we call both the functions and print the following output.