Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Step 2 : In this part, we add implementation to existing design 1 . Add a boolean instance variable to GreenhouseControls called fans . Create

Step 2: In this part, we add implementation to existing design
1. Add a boolean instance variable to GreenhouseControls called fans. Create two Event classes called FansOn and FansOff. The action() of these two classes should modify fan to true or false respectively.
2. Modify Bell Event so that it will be able to run an arbitrary number of times separated by 2000 msec each. To facilitate this requirement, you should generate the number of Bell Events specified in the rings parameter in the examples file. Please pay special attention to the possibility that other events might be run in between the various Bell events.
3. Modify Restart.action() to start the the system by reading events from a text file. Use Scanner and an appropriate regular expression.
4. Try running GreenhouseControls by:
java GreenhouseControls -f examples1.txtu
and
java GreenhouseControls -f examples2.txt
5. The -f argument must be present. It must be either -f or -d. Please see Part 4. The event information must be in the format specified in examples1.txt and examples2.txt.
Step 3: Add functionality to simulate problems
1. Create a WindowMalfunction and PowerOut Events to simulate problems that may occur in a GreenhouseControls. The event should set the following boolean variables as appropriate in GreenhouseControls:
windowok = false;
poweron = false;
After setting the variables, WindowMalfunction or PowerOut should throw an exception specifying the faulty condition. Create a ControllerException class that extends Exception for this purpose.

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

Recommended Textbook for

Oracle 12c SQL

Authors: Joan Casteel

3rd edition

1305251032, 978-1305251038

More Books

Students also viewed these Databases questions