Photo AI
Question 3
During the period leading up to the Christmas holidays, P-Cubed hires temporary staff. Staff are hired for each of the six weeks prior to Christmas week. Here is th... show full transcript
Step 1
Answer
The algorithm starts by defining the percentage of staff needed for each week leading up to Christmas. This is held in an array named staffRates
, with values corresponding to the staff needed from week -6 to -1. The weekNumber
array indicates the specific weeks.
Step 2
Answer
The algorithm prompts the user to enter the number of staff for week -7. It checks if the input, currentCount
, is valid (greater than or equal to 200). If valid, it proceeds; otherwise, it shows an error message, and the input process repeats until valid data is provided.
Step 3
Answer
Finally, the system calculates the required staffing for the subsequent six weeks. It iterates through the weekNumber
array using a loop, calculating neededStaff
as currentCount
multiplied by the corresponding percentage from staffRates
. Each week's requirement is then displayed.
Report Improved Results
Recommend to friends
Students Supported
Questions answered