A business needs to calculate the bonus points for sales representatives. The bonus points are based on how much each sales representative sold the year.
Write a program to prompt the user to enter the sales amount for a sales representative. Include different functions for each group of Sales representatives.
Display the bonus points as integers.
Please see the table showing the Groups, Sales, and Bonus points:
Groups Sales Bonus points
A $0 - $100, 000 500 points
$100, 001 - $1,000,000 1, 500 points
B $1,000,001 - $2,000, 000 2,000 points
$2,000,001 - $3,000, 000 2, 500 points
C $3,000,001 - $4,000, 000 3, 000 points
$4,000,001 and over 5, 000 points
Input Validation: Do not accept negative numbers for sales.
#include <iostream>
#include <iomanip>
using namespace std;
float salesamounts; (sales made)
int username; (Sales rep name)
int main()
{
cout << “Please enter your sales made for the year: $”
cin >> salesamounts;
count << endl;
// exception on program
if (salesamounts <= -1);
{
if (salesamounts <= -1);
cout << “Value cannot be negative. Please input again.”
}
// Group A placement
for (;salesamount <= 100000;)
{
if ((salesamounts <= 100000)
cout << “Congratulations! You earned 500 Bonus Points!”
break;
{
for (; salesamounts > 100001 < 1000000;)
{
if ((salesamounts > 100001 < 1000000));
cout << “Congrats! 10000 Bonus Points have been credited to you!”
break;
}
}
The problem I’m having is that when I debug it, it all runs at once with no respect to the restraints what so ever. I don’t know what’s wrong or what’s right.
When I ran it in MS Visual Studio, the line to input ran correctly but the output was everything in the code, including the restriction on the negative value.
It would look something like:
“Enter value: $1
Please enter value again. Congratulations! 500 Bonus Points! Congrats! You’ve been awarded 10000 bonus points!
Code ran successfully. Please press any key to exit.”
Maybe you should post the code you can run instead of the stuff you've posted above because it is incomplete and littered with errors with absolutely no chance of running let alone the messages you had.
I very much doubt this code runs at all - as what is posted is invalid C++ code and won't compile, let alone run at all. If something runs then you're running an old version of the code that did compile at some point - not this code.
1. Don't put semi-colons after your if statement.
2. ((salesamounts > 100001 < 1000000)); makes no sense.
Did you mean,
(salesamount > 100001 && salesamount < 1000000)