Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class IrrigationSystem {
- private String systemID;
- private double waterCapacity;
- private 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.";
- }
- public String getSystemID() {
- return systemID;
- }
- public void setSystemID(String systemID) {
- this.systemID = systemID;
- }
- public double getWaterCapacity() {
- return waterCapacity;
- }
- public void setWaterCapacity(int waterCapacity) {
- this.waterCapacity = waterCapacity;
- }
- public boolean isAutomated() {
- return isAutomated;
- }
- public void setAutomated(boolean automated) {
- isAutomated = automated;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement