If loop used
– initialisation before loop
– loop
– running total inside loop
– calculation of average outside loop
– output of average with message outside loop
(Max 4 marks)
– completion of at least 3 of initialisation, running total, calculation of average and
output of average with message for both midday and midnight
(1 mark)
sample algorithm:
MiddayTotal ← 0; MidnightTotal ← 0
FOR Count ← 1 TO 7
MiddayTotal ← MiddayTotal + MiddayTemperature[Count]
MidnightTotal ← MidnightTotal + MidnightTemperature[Count]
NEXT Count
MiddayAverage ← MiddayTotal/7
MidnightAverage ← MiddayTotal/7
PRINT 'The average midday temperature is ', MiddayAverage
PRINT 'The average midnight temperature is ', MidnightAverage
If loop not used
– total of 7 midday temperatures
– calculation of midday average (Note could be combined as one calculation,
see example below)
– total of 7 midnight temperatures
– calculation of midnight average (Note could be combined as one calculation,
see example below)
– output of both averages with suitable messages
sample algorithm:
MiddayAverage ← (MiddayTemperature[1]+ MiddayTemperature[2]+
MiddayTemperature[3]+ MiddayTemperature[4]+
MiddayTemperature[5]+ MiddayTemperature[6]+
MiddayTemperature[7])/7
MidnightAverage ← (MidnightTemperature[1]+
MidnightTemperature[2]+ MidnightTemperature[3]+ Midnight[4]+
Midnight[5]+ Midnight[6]+ MidnightTemperature[7])/7
PRINT 'The average midday temperature is ', MiddayAverage
PRINT 'The average midnight temperature is ', MidnightAverage