During the period leading up to the Christmas holidays, P-Cubed hires temporary staff - Edexcel - GCSE Computer Science - Question 3 - 2018 - Paper 1
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
Worked Solution & Example Answer:During the period leading up to the Christmas holidays, P-Cubed hires temporary staff - Edexcel - GCSE Computer Science - Question 3 - 2018 - Paper 1
Step 1
Percentage of staff needed in 6 weeks prior to Christmas
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
In this part, we establish the staff requirements based on the weeks leading to Christmas. The array weekNumber contains values representing the six weeks leading up to Christmas, and staffRates holds the corresponding staff percentages required for each of those weeks.
Step 2
Validate the input
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Here we validate that the entered currentCount of staff meets the necessary criteria. If the input is less than 200, an error message is displayed, and the process repeats until a valid count is entered.
Step 3
Print requirements
96%
101 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
In this step, we loop through the weeks to calculate required staffing. For each week, percentage is computed using corresponding staffRates, and then the neededStaff is calculated by multiplying currentCount by percentage. The output displays how many additional staff members are needed for each week.