Menu

[Solved]Write Functions Called Main Function Produce Outputs C Program Please Fix Code Include Flo Q37185411

Enter the monthly sales: 14550.00 Enter the amount of advanced pay, or enter 0 if no advanced pay was given Advanced pay: 100

Write the functions that are called in the main()function to produce these outputs. C program.

Please fix my code…

#include<stdio.h>
float sales();
float advanced();
float commrate();
float pay();

int main();
{

sales=get_sales();
advanced_pay=get_advanced_pay();
comm_rate=determine_comm_rate(sales);

pay=sales*comm_rate-advanced_pay

printf(“The pay is $%lf”,pay);

if(pay<0)
{
    printf(“The saleperson must reimburse thecompany”);
}

return 0;
}

float sales()
{
float monthly_sales;

printf(“Enter the monthly sales: “);
scanf(“%lf”,&monthly_sales);

return monthly_sales;
}

float advanced()
{
float advancedpay

    printf(“Enter the amount of advanced pay, orenter 0 if no advanced pay was given.”);
    scanf(“%lf”,&advancedpay)

return advancedpay;
}

float commrate();
{
    float commissionrate;
    if sales<10000.00:
    rate=0.10
elif sales>=10000.00 and sales<=14999.99:
rate=0.12
elif sales>=15000.00 and sales<=17999.99:
rate=0.14
elif sales>=18000.00 and sales<=21999.99:
rate=0.16
elif sales>21999.99:
rate=0.18

return commissionrate;
}

Requirements for the function -determine_comm_rate()

Sales less than 10000.00 rate:  .10

Sales from 10000.00 to 14999.99 rate: .12

Sales from 15000.00 to 17999.99 rate: .14

Sales from 18000.00 to 21999.99 rate: .16

Sales greater than 21999.99 rate: .18  

Enter the monthly sales: 14550.00 Enter the amount of advanced pay, or enter 0 if no advanced pay was given Advanced pay: 1000.00 The pay is $746.00 Enter the monthly sales: 9500 Enter the amount of advanced pay, or enter 0 if no advanced pay was given Advanced pay: 0 The pay is $950.00 Enter the monthly sales: 12000.00 Enter the amount of advanced pay, or enter 0 if no advanced pay was given Advanced pay: 2000.00 The pay is $-560.00 The salesperson must reimburse the company //Pseudocode for the main() function, you will have to make it to C codes //This program calculates a salesperson’s pay int main() # Get the amount of sales from user sales -get_sales() // Get the amount of advanced pay from user advanced_pay-get_advanced_pay() //Determine the commission rate comm_rate determine_comm_rate(sales) // Calculate the pay pay sales * comm_rate – advanced_pay // Display the amount of pay print this(” The pay is $ %f’ , pay) // Determine whether the pay is negative if (pay < 0) print this(‘The salesperson must reimburse the company’) return 0; Show transcribed image text Enter the monthly sales: 14550.00 Enter the amount of advanced pay, or enter 0 if no advanced pay was given Advanced pay: 1000.00 The pay is $746.00 Enter the monthly sales: 9500 Enter the amount of advanced pay, or enter 0 if no advanced pay was given Advanced pay: 0 The pay is $950.00 Enter the monthly sales: 12000.00 Enter the amount of advanced pay, or enter 0 if no advanced pay was given Advanced pay: 2000.00 The pay is $-560.00 The salesperson must reimburse the company //Pseudocode for the main() function, you will have to make it to C codes //This program calculates a salesperson’s pay int main() # Get the amount of sales from user sales -get_sales() // Get the amount of advanced pay from user advanced_pay-get_advanced_pay() //Determine the commission rate comm_rate determine_comm_rate(sales) // Calculate the pay pay sales * comm_rate – advanced_pay // Display the amount of pay print this(” The pay is $ %f’ , pay) // Determine whether the pay is negative if (pay

Expert Answer


Answer to Write the functions that are called in the main() function to produce these outputs. C program. Please fix my code… #i… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *