Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class IrrigationSystem {
- public String systemID;
- public double waterCapacity;
- public boolean isAutomated;
- public IrrigationSystem(String systemID, double waterCapacity, boolean isAutomated) {
- this.systemID = systemID;
- this.waterCapacity = waterCapacity;
- this.isAutomated = isAutomated;
- }
- public String toString() {
- return "The system id is: " + systemID +
- "\nThe capacity of the water of the system is: " +
- waterCapacity + (isAutomated? "\nThe system is automated." : "\nThe system is not automated");
- }
- public String Irrigate(String field, double waterAmount) {
- waterCapacity += waterAmount;
- return field + " has been irrigated with " + waterCapacity + " water.";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement