Ask Question
11 May, 06:44

C programing---Write the functions that are called in the main () function to produce these outputs. Enter the monthly sales: 14550.00 Enter the amount of advanced pay, or enter 0 if no advanced pay was given Advanced pay: 100 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

+2
Answers (1)
  1. 11 May, 09:09
    0
    Following are the program in the C programming Language:

    #include / /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/n", 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

    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.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “C programing---Write the functions that are called in the main () function to produce these outputs. Enter the monthly sales: 14550.00 ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers