Answer to Question #161795 in C++ for Anonymous

Question #161795

A company changes the commission rate for sales reps depending on their total sales for the month. Their regular commission is 5% (.05). However, if they sell at least $100,000, they get 7% (.07). Ask the user for the sales amount this month and then calculate how much to pay the sales rep this month.


Output 1:

Enter the sales amount for the month as a whole number, no commas or $:  [assume user types: 125000]

You met the $100,000 sales goal for the month. Your commission is 7%

Your total commission on $125000 is: $8750

 

Output 2:

Enter the sales amount for the month as a whole number, no commas or $:  [assume user types: 60000]

You did not meet the $100,000 sales goal for the month. Your commission is 5%

Your total commission on $60000 is: $3000


Hints and Notes:

1) Use an If/Else for this

2) The "100,000" portion of the output is a literal. I did not use the constant for this part of the output because I wanted to format the message nicely for the user.


1
Expert's answer
2021-02-07T16:51:09-0500
#include <iostream>
#include <math.h>     // math.h is for   double round(double)   function

int main()
{
    long amount, comission;
    std::cout << "Enter the sales amount for the month as a whole number, no commas or $: ";
    std::cin >> amount;
    if (amount < 100000)
    {
        std::cout << "You did not meet the $100,000 sales goal for the month. Your commission is 5%\n";
        comission = (long)round(amount * 0.05);
    }
    else
    {
        std::cout << "You met the $100,000 sales goal for the month. Your commission is 7%\n";
        comission = (long)round(amount * 0.07);
    }
    std::cout << "Your total commission on $" << amount << " is: $" << comission << ".";
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog