Lesson 8.2 · Answer it
Greenhouse pot
5 marksYou mark it yourself against the marking points
A greenhouse called North House has 300 plant pots, each with a small sensor. A program keeps track of every pot. For each pot it keeps the name of the plant growing in it and how wet the soil is, as a whole-number percentage. A pot can be watered, which raises its wetness by an amount the gardener chooses. A pot can also report whether it needs water, which it does when its wetness is below 30. The name North House appears at the top of every screen.
The programmer writes a class called Pot, and makes one Pot object for each pot.
(a) Identify the two attributes that Pot needs. [2]
(b) Identify the two methods that Pot needs. [2]
(c) Explain why the name North House should not be an attribute of Pot. [1]
[5]