Question
in this assignment, you are to create a java program to simulate water sprinkler control system for a property using OOP design. The water system
in this assignment, you are to create a java program to simulate water sprinkler control system for a property using OOP design. The water system is fed by a main water supply line that can handle a maximum flow rate of 20 (max f=20). The property is dividing into 3 zones named ZONE0, ZONE1, and ZONE2 each having a maximum water flow rate of f=10, f=3, and f=13. Each zone has its own set of sprinklers: ZONE0 has 4 sprinklers, ZONE1 has 3 sprinklers, ZONE2 has 7 sprinklers. Each sprinkler draws a different flow rate from the zone it belongs to. The flow rates drawn from each sprinkler and the overall pictorial representation of the property is shown as following:
MAIN WATER LINE. Max f=20
Zone 0, max f=10, f=5, f=3, f=1, f=6
Zone 1, max f=3 , f=2, f=2, f=1, garden
Zone 2 max f=13 f=2 , f=4, f=2, f=1, f=5, f=2, f=3
Main Menu:
1. Turn off water supply to an entire zone.
2. Turn on water supply to an entire zone.
3. Change the maximum water capacity usage of a zone.
4. Turn on any individual sprinkler.
5. Turn off any individual sprinkler.
6. Change the maximum water capacity for the entire property.
7. Move the gardener to another zone.
8. Display a report on the current status of all zones, sprinklers, and total water flow in use for the system.
Initial Conditions:
Assume at start-up that all the sprinklers are turned "off" and all zones water supply intake is set to "off". Also assume the gardener is in zone 1.
Restrictions:
1. You can't turn on a sprinkler (menu option 4) if the zone it belongs to is turned off (menu option 1).
2. You can't turn on a sprinkler (menu option 4) if doing so would exceed the maximum water usage allowed for that zone.
3. You can't turn on a sprinkler (menu option 4) if doing so would exceed the maximum water usage allowed for the entire property.
4. You can't turn on a sprinkler (menu option 4) if the gardner is in the zone the sprinkler belongs to.
5. You can't turn on the water supply to a zone (menu option 2) if the gardner is in that zone UNLESS all the sprinklers within that zone are set to OFF (menu option 5).
6. A gardener can not move into a zone (menu option 7) where there are any sprinklers turned on UNLESS that zone's water supply is off.
7. You can't change the maximum water capacity usage of a zone (menu option 3) if the number you change it to is less than the total flow currently in use at that zone.
8. You can't change the maximum water capacity for the entire property (menu option 6) to a number that is less than the currently in use combined flow of all the zones.
Example Output:
ZONE 1 (WATER SUPPLY = ON, CURRENT FLOW = 6, MAX FLOW=10)
sprinkler 0 (STATUS = ON, FLOW IF ON = 1)
sprinkler 1 (STATUS = OFF, FLOW IF ON = 3)
sprinkler 2 (STATUS = OFF, FLOW IF ON = 6)
sprinkler 3 (STATUS = ON, FLOW IF ON = 5)
ZONE 2 (WATER SUPPLY = OFF, CURRENT FLOW = 0, MAX FLOW=13)
sprinkler 0 (STATUS = ON, FLOW IF ON = ...)
sprinkler 1 (...)
sprinkler 2 (...)
TOTAL WATER USAGE = 6, MAX USAGE = 20
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started