The diving competitions at the gala will be scored by five judges - Edexcel - GCSE Computer Science - Question 9 - 2021 - Paper 1
Question 9
The diving competitions at the gala will be scored by five judges. Each judge awards each dive a score between 0.0 and 10.0. The highest and lowest of the judges' sc... show full transcript
Worked Solution & Example Answer:The diving competitions at the gala will be scored by five judges - Edexcel - GCSE Computer Science - Question 9 - 2021 - Paper 1
Step 1
ARRAY scores
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
Initialize an array to hold the scores from the judges:
ARRAY scores
SET scores TO [8.9, 9.1, 8.2, 7.8, 8.1]
REAL inFactor
Step 2
Receive inFactor from 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
Prompt the user to input the degree of difficulty factor:
RECEIVE inFactor FROM (REAL) KEYBOARD
Step 3
Find highest and lowest scores
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
Initialize variables to track the highest and lowest scores:
SET highest TO 0.0
SET lowest TO 10.0
Use a loop to determine the highest and lowest scores in the array.
Step 4
Calculate total score without highest and lowest
98%
120 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
After identifying the highest and lowest scores, calculate the total of the three remaining judges' scores:
FOR index FROM 1 TO LENGTH(scores) DO
IF scores[index] > highest THEN
highest = scores[index]
END IF
IF scores[index] < lowest THEN
lowest = scores[index]
END IF
END FOR
Then sum the relevant scores.
Step 5
Calculate dive score
97%
117 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!