This algorithm calculates the loyalty points a customer receives when recycling plastic at a smart deposit point:
01 weight = input("Enter weight")
02 isVIP = input("Is customer VIP? (Y/N)")
03 if weight >= 15.0 then
04 points = 5
05 elseif weight >= 5.0 then
06 points = 3
07 else
08 points = 1
09 endif
10 if isVIP == "Y" then
11 points = points + 3
12 endif
13 print("Points awarded:", points)
Complete the trace table for the algorithm when a customer recycles a weight of 8.5 and has VIP status input as "Y".
You may not need to use all the rows in the table.
| Line number | weight | isVIP | points | Output |
|---|---|---|---|---|
41 exam-style questions on OCR GCSE Computer Science Designing, creating and refining algorithms. Each one has a worked solution and a mark scheme showing where the marks go.