Week 2 Challenge Assignment (Worth 25 extra points for the week if successfully completed)
In addition to your regular assignment you may attempt to complete the following challenge assignment for extra credit. If you do not attempt the assignment or hand it in your grade for the week will not be affected. If you complete the assignment, meet all of the requirements listed, and the program compiles and runs then you will receive 25 extra credit points for the week. The challenge is only valid for points during the week in which it is available.
This is not a substitute for your regular assignment and you will only receive the extra credit if you have also submitted your regular assignment.
I would also encourage you to try the challenge as practice even if you do not choose to submit it.
1. Make a console application, no user defined class is necessary for this program, all code is to be implemented in Main.
2. Declare variables that will hold values for double sales, integer salesman number, double employee pay and declare three type double constants for COMMRATE1, COMMRATE2 and COMMRATE3. Initialize all of your variables when declared and set values of 0.10, 0.20 and 0.30 for COMMRATE1, 2 and 3 respectively
3. Make a sentinel while loop to take inputs for employee sales until the user enters a zero. The sentinel should be based on the entry of the integer salesman number.
4. In the while loop:
if sales is greater than 3000 then set the employee pay to zero and write “Invalid sales entry” to the console because no sale greater than 3000 should be entered
else if sales greater than or equal to 500 and sales less than or equal to 1000 then set employee pay equal to sales times COMMRATE1
else if sales greater than 1000 and sales less than or equal to 2000 then set employee pay equal to sales times COMMRATE2
else if sales greater than 2000 and sales less than or equal to 3000 then set employee pay equal to sales times COMMRATE3
else set employee pay equal to sales
The input and output would look like this
enter sales # for employee 1
enter sales amount for employee 1 2000
The pay for salesman #1 is 400
enter sales # for employee 2
enter sales amount for employee 2 3500
Invalid sales entry
The pay for salesman #2 is 0
enter sales # for employee 2
enter sales amount for employee 2 3000
The pay for salesman #2 is 900
enter sales # for employee 33
enter sales amount for employee 33 1580The pay for salesman #33 is 316
enter sales # for employee
Hi there! Click one of our representatives below and we will get back to you as soon as possible.