Please help me with my assignment. [Arrays]

Write a program called Payroll.cpp that asks for the number of hours worked by any number
of employees and calculate the average hours these employees worked. It should store
the values in an integer array.
Declare a named constant for the maximum size of the array and assign it the value 10000.
The program should use a sentinal to end. When the user enters 999, the program should
end and display the required output. The number of hours each employee worked should
be listed and their average should be calculated and displayed as shown in the following is
a sample test run of the program (user input is shown in bold):
Enter 999 to stop input
Enter the hours worked by employee #1: 22
Enter the hours worked by employee #2: 33
Enter the hours worked by employee #3: 35
Enter the hours worked by employee #4: 999
----------------------------------------------------------
The hours you entered are: 22 33 35
The employee(s) worked an average of 30.0 hours this week.
----------------------------------------------------------
The program should terminate without showing the final results when invalid input is entered.
Values above 50 hours as well as negative input should be treated as invalid. The
following is a sample test run of the program when the program ends with an error message
(user input is shown in bold):
Enter 999 to stop input
Enter the hours worked by employee #1: 10
Enter the hours worked by employee #2: -12
----------------------------------------------------------
You have entered -12. It is invalid. Program terminated.
----------------------------------------------------------
The program should check for abnormal input. Values above 40 as well as 0 should be
treated as abnormal input. When the user enters an abnormal value the program should
prompt for confirmation. If the user confirms the program should accept the value and
continue. If the user does not confirm, the program should terminate after showing an error
message. The following is a sample test run of the program that includes rejection of an
abnormal value (user input is shown in bold):
Enter 999 to stop input
Enter the hours worked by employee #1: 8
Enter the hours worked by employee #2: 17
Enter the hours worked by employee #3: 21
Enter the hours worked by employee #4: 0
You have entered 0, which is an abnormal input. Please confirm input (Y or N): N
----------------------------------------------------------
You have entered 0 and indicated that it is invalid. Program terminated.
----------------------------------------------------------
The following is a sample test run of the program that includes positive confirmation of an
abnormal value (user input is shown in bold):
Enter 999 to stop input
Enter the hours worked by employee #1: 10
Enter the hours worked by employee #2: 12
Enter the hours worked by employee #3: 33
Enter the hours worked by employee #4: 45
You have entered 45, which is an abnormal input. Please confirm input (Y or N): Y
Enter the hours worked by employee #5: 13
Enter the hours worked by employee #6: 20
Enter the hours worked by employee #7: 25
Enter the hours worked by employee #8: 22
Enter the hours worked by employee #9: 23
Enter the hours worked by employee #10: 24
Enter the hours worked by employee #11: 999
----------------------------------------------------------
The hours you entered are: 10 12 33 45 13 20 25 22 23 24
The employee(s) worked and average of 22.7 hours this week.
----------------------------------------------------------
What's your problem?
i don't know how and when to use the 999 to stop the loop input. can you please help me with the program above. i tried doing it several times but it doesn't give me the correct output
If you show us your code, we can help you fix your problem.
Topic archived. No new replies allowed.