I need to write a program to produce a sales report similar to the one below that indicates individual percentage contribution by each employee. The program must allow the user to enter a user id number and sales amount for up to 10 employees, but must allow fewer to be entered if desired, stopping input when the user enters the value zero for an employee id number.
Emp.ID $ Sales % Sales
-------------------------
p12345 $3000.00 30%
24681 $1000.00 10%
35791 $4000.00 40%
48484 $2000.00 20%
-------------------------
Total: $10000.00 100%
My output window should be similar to the following:
Employee ID Number (0 when done)? 12345
Sales volume for this period? $ 3000.00
Employee ID Number (0 when done)? 24681
Sales volume for this period? $ 1000.00
Employee ID Number (0 when done)? 35791
Sales volume for this period? $ 4000.00
Employee ID Number (0 when done)? 48484
Sales volume for this period? $ 2000.00
Employee ID Number (0 when done)? 0
User input complete.
EMPLOYEE SALES WITH PERCENTAGE BREAKDOWN
Emp.ID $ Sales % Sales
-------------------------
12345 $3000.00 30%
24681 $1000.00 10%
35791 $4000.00 40%
48484 $2000.00 20%
-------------------------
Total: $10000.00 100%
Press any key to continue...
I need to declare 3 arrays. The first array will hold the employee ID. The second array will hold the amount of sales for that employee. Finally, the third array will hold the percentage of sales for each employee.
The percentage sales for each employee should be the last thing to be calculated. You have to read the ID and the sales amount first, and as you do that, you accumulate the sales of each employee to a total. To get the percentage of each employee's sales, use the following formula:
Percentage = 100 * Sales Amount/Total Sales
I need to calculate the percentage, add the percentage to a total as well, so that you can print it at the bottom of your sales report table.