Here is a pseudo-code algorithm designed to calculate the forecasted server load scaling for an online platform over a 5-hour launch window.
2 # Expected loads over 5 hours post-launch
3 SET hourNumber TO ["+1", "+2", "+3", "+4", "+5"]
4 SET loadScaling TO [115, 130, 145, 160, 180]
5 SET goodInput TO False
6
7 # Validate base load capacity
8 WHILE (goodInput = False) DO
9 SEND "Enter the baseline server capacity (min 500): " TO DISPLAY
10 RECEIVE baseCapacity FROM (INTEGER) KEYBOARD
11
12 IF (baseCapacity >= 500) THEN
13 SET goodInput TO True
14 SEND "Baseline capacity recorded: " & baseCapacity TO DISPLAY
15 ELSE
16 SEND "Invalid baseline capacity" TO DISPLAY
17 END IF
18 END WHILE
19
20 # Calculate hourly scaling requirements
21 FOR i FROM 0 TO (LENGTH(hourNumber)-1)
22 SET scaleFactor TO loadScaling[i] / 100
23 SET forecastedLoad TO baseCapacity * scaleFactor
24 SEND "Hour " & hourNumber[i] & " forecast: " & forecastedLoad TO DISPLAY
25 END FOR
Complete the trace table to show the execution of lines 21 to 25 of the pseudo-code for the event iteration where i = 2 when the user enters the value 800 at line 10.
| baseCapacity | i | LENGTH(hourNumber) | scaleFactor | loadScaling[i] | forecastedLoad |
|---|---|---|---|---|---|