Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

OBJECT ORIENTED PROGRAMMING (OOP) SPRINKLER SIMULATION In this assignment, you are to create a water sprinkler control system for a property using OOP design. The

OBJECT ORIENTED PROGRAMMING (OOP) SPRINKLER SIMULATION

In this assignment, you are to create a 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:

CLICK HERE FOR PICTURE

Also, the property has ONE gardener that attends to the grounds. A starting UML diagram for the entire system is available here:

CLICK HERE FOR UML DIAGRAM (AS A NETBEANS FILE)

CLICK HERE FOR UML DIAGRAM AS A PNG FILE

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.

Please provide #1 and #2 in an archive file (.ZIP or .RAR format) and upload it here.

MARKS:

PART I - UML Modeling. 15% of overall mark. Complete the URL diagram that was provided as a starting point (add attributes/methods/additional classes). The UML design must match the code that you submit.

Part II - Write the program. 45% of overall mark. Construct a working program that presents the menu choices and adheres to all the restrictions. The program must be written in an OOP design (see UML diagram) with distinct objects: TestingDriver, SprinklerSimulation, MainWaterLine, Zones, Sprinklers, Gardener (15% of mark plus 30% as allocated above. See Main Menu and Restrictions).

Part III - Document Java Code. 35% of overall mark. Fully document the program INCLUDING THE CLASSES THEMSELVES in addition to the attributes, methods and method body.

"Style Marks" - 5%. Awarded at my discretion. Impress me with your diagram,effort and design thoughts.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

2. What types of information are we collecting?

Answered: 1 week ago