Question
please create a java program to simulate water sprinkler control system for a property using OOP design. The water system is fed by a main
please 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 available by clicking here:
Also, the property has ONE gardener that attends to the grounds. A starting UML diagram for the entire system is available here:
Design a system that provides a main menu that appears as follows:
Main Menu:
1. Turn off water supply to an entire zone. (1% of PART II Marks)
2. Turn on water supply to an entire zone. (1% of PART II Marks)
3. Change the maximum water capacity usage of a zone. (1% of PART II Marks)
4. Turn on any individual sprinkler. (1% of PART II Marks)
5. Turn off any individual sprinkler. (1% of PART II Marks)
6. Change the maximum water capacity for the entire property. (1% of PART II Marks)
7. Move the gardener to another zone. (1% of PART II Marks)
8. Display a report on the current status of all zones, sprinklers, and total water flow in use for the system. (4% of PART II Marks)
Example Report:
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
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% of PART II Marks)
2. You can't turn on a sprinkler (menu option 4) if doing so would exceed the maximum water usage allowed for that zone. (2% of PART II Marks)
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. (3% of PART II Marks)
4. You can't turn on a sprinkler (menu option 4) if the gardner is in the zone the sprinkler belongs to. (2% of PART II Marks)
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). (3% of PART II Marks)
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. (3% of PART II Marks)
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. (2% of PART II Marks)
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. (2% of PART II Marks)
Requirements
- You must use an object oriented design. Recommended you use the starting UML diagram as a guide.
- You must use Arrays of Objects in your design. Specifically, each of the three zones must maintain its own array of Sprinkler objects. Also the SprinklerSimulation object must maintain its Zone Objects in an Array. (see UML diagram).
Deliverables
1. Supply a UML Diagram complete with attributes and methods for each class including associations and inheritance relationships. You can use the UML diagram provided in this assignment and fill in the details or you can modify the given UML diagram to suite your needs or you can create a UML diagram from scratch. However, your UML diagram MUST portray an object oriented design: It must have at least the classes represented that the provided UML diagram has.
2. Supply the Java source code of your program. Your program must be fully documented and match the UML diagram. Also, your program must compile in order for it to be marked.
TestingDriver + static void main(Stri nan args) starts MainWaterLine SprinklerSimulation creates -ZonesOpropertyZones- o+void start0 o+void displayMainMenu0 connects_to creates Zones -Sprinklers zoneSprinklers creates exclusivly_has contains Gardner Sprinklers TestingDriver + static void main(Stri nan args) starts MainWaterLine SprinklerSimulation creates -ZonesOpropertyZones- o+void start0 o+void displayMainMenu0 connects_to creates Zones -Sprinklers zoneSprinklers creates exclusivly_has contains Gardner SprinklersStep 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