Answered You can hire a professional tutor to get the answer.

QUESTION

Week 2 Challenge Assignment (Worth 25 extra points for the week if successfully completed) In addition to your regular assignment you may attempt to

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:

  • prompt the user for salesman number entry: "enter sales # for employee "
  • convert the keyboard entry to integer and assignment to salesman number
  • if the salesman number for the entry was a zero write "Ending program" to the console and break
  • prompt the user to "enter sales amount for employee 1"
  • convert the entry to double and assign it to sales
  • evaluate the following criteria:
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 enteredelse if sales greater than or equal to 500 and sales less than or equal to 1000 then set employee pay equal to sales times COMMRATE1else if sales greater than 1000 and sales less than or equal to 2000 then set employee pay equal to sales times COMMRATE2else if sales greater than 2000 and sales less than or equal to 3000 then set employee pay equal to sales times COMMRATE3else set employee pay equal to sales
  • write the salesman pay to the console, designating the salesman number you have computed pay for; for example: "The pay for salesman #33 is 158"

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 

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question