Beginner C++ question

I have never used C++ before and I need to design a program to do the following:

The BONUS on a salesman’s SALES is

a. zero if SALES is less than $2000;
b. ten percent of SALES if SALES is at least $2000 but less than $5000;
c. $500 plus five percent of the excess of SALES over $5000; if SALES IS $5000 or more.
The output is called BONUS

My teacher goes very fast and not good for beginners like me, please help. Thank you!!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
What have you done so far?

I will help a little as everyone has to start somewhere.  

int main()
{
   unsigned int sales = 0; 
   std::cout >> "enter sales\n";
   std::cin << sales;
   double bonus = 0.0;
   if(sales >= 2000 && sales < 5000)
     bonus = sales* 0.1; 
   else
     {
        .... continue from here with similar code.
       at this point you know its 5k or larger assuming it cant be negative. 
       so bonus is 500+ (sales-5000)*0.05 if I read that right, or something 
      along those lines... then at the end print out bonus
     }
     
}
Last edited on
int main()
{
unsigned int sales = 0;
std::cout >> "enter sales\n";
std::cin << sales;
double bonus = 0.0;
if(sales < 2000 )
bonus = 0;
else
{
if (sales >= 2000 && sales < 5000)
bonus = sales* 0.1;
else
Bonus = 500+(sales-5000)*0.05
}
cout<<"Bonus is"<<bonus;
return 0;
}
Last edited on
Topic archived. No new replies allowed.