An automated greenhouse control program is being developed to display soil moisture records and calculate water usage costs. It displays each moisture level stored in an array of readings.
1: TAX_THRESHOLD = 150.0
2: moisture_readings = [45.2, 48.0, 39.5, 55.1, 42.8]
3: total_water = 0.0
4: print("Historical Moisture Levels:")
5: for level in moisture_readings:
6: print(str(level) + "%")
7: allocation = float(input("Enter water volume in litres (-1 to stop): "))
8: while allocation != -1.0:
9: total_water = total_water + allocation
10: allocation = float(input("Enter water volume in litres (-1 to stop): "))
11: if total_water > TAX_THRESHOLD:
12: tax_rate = 0.18
13: else:
14: tax_rate = 0.08
15: final_cost = total_water * (1 + tax_rate)
16: print("Total cost of water: £" + str(final_cost))
Identify the code features requested below from the program snippet shown above:
Name of a constant used in the program
Name of an array used in the program
Line number of an initialisation of a variable with a real number
Line numbers for a selection construct
Line numbers for a repetition construct (condition-controlled loop)
Line numbers for an iteration construct (count-controlled/collection loop)
Line number for an instruction that outputs information to the screen