A landscape designer writes an algorithm to determine whether a trapezoidal flower bed has a "Standard Area" based on its parallel sides aaa and bbb, and its perpendicular height hhh.
If the area of the flower bed is between 120 and 250 inclusive, "Standard Area" is output.
If the area is not between 120 and 250 inclusive, "Custom Area" is output.
01 a = input("Enter side a")
02 b = input("Enter side b")
03 h = input("Enter height")
04 area = 0.5 * a + b * h
05 if area >= 120 then
06 print("Standard Area")
07 else
08 print("Custom Area")
09 endif
The algorithm does not work correctly.
Identify the line numbers of the two logic errors in the algorithm and write the corrected code for each line.
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.