Interface Plant
-
- All Known Implementing Classes:
Carrot
public interface PlantInterface for a Plant. Specifies the behaviors that all plants must implement.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidelapseDay()Ages the plant by a day.java.lang.StringgetName()Returns the name of the plant.java.lang.StringgetStatus()Returns a string describing the state of the plant.intgetWaterLevel()Returns the current water level for the plant.voidwaterPlant(int unitsWater)Waters the plant with unitsWater water.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Returns the name of the plant.- Returns:
- String representing plant's name
-
waterPlant
void waterPlant(int unitsWater)
Waters the plant with unitsWater water.- Parameters:
unitsWater- number of units of water the plant receives
-
elapseDay
void elapseDay()
Ages the plant by a day. This could change the plant's water level or other characteristics.
-
getStatus
java.lang.String getStatus()
Returns a string describing the state of the plant. E.g., might say "overly dry" or "abundantly happy". State of the plant may vary with water level or other characteristics.- Returns:
- String representing status
-
getWaterLevel
int getWaterLevel()
Returns the current water level for the plant. Each plant has a water level indicating whether it is dry, water-logged, or somewhere in between.- Returns:
- int representing water level
-
-