java thread problem (tutor)
This project has been awarded to fifteenhex for $150 CAD.Get free quotes for a project like this
Project Budget$150 CAD
Write and submit one complete Java program to solve the following requirements. Your program will employ packages (that is, source directories), and contain multiple source files. Because you are using packages, much of your code should be in a directory named “Greenhouse.” You should be able to compile your code using the command “javac Greenhouse\*.java” from a directory just below the Greenhouse directory.
Greenhouse is a house in which many events could happen, for example, doors may open and close, windows may open and close, fans may turn on or off, lights may turn on or off, an alarm may sound, the thermostat may turn on or off, watering machines may start or stop, and so on. Each event has its own timer and jobs (Hint: use a superclass with separate subclasses, and a thread); for example, the alarm may sound five times when the thermostat has failed, and the fans may not come on until this situation is resolved, even if the fans are supposed to be on. Different events may have different priorities.
At the very beginning, a greenhouse (i.e., an object/instance of the Greenhouse class) has to read the operating plan from the file greenhouse_plan.txt. The contents and format of the file are listed below. Note: You cannot alter the format of this file, but you may add additional events when testing.
Of course, the greenhouse should be able to restart the process if two conditions are met: (1) the user asks the greenhouse to do so; (2) the greenhouse catches an exception when doing jobs according to [url removed, login to view] – for example, if an event is not able to start because no specific event class is implemented. If the second condition occurs, the greenhouse will restart the process, skipping the instruction that caused the problem.
Provide the means to read classes from the file, and create classes from their names (Hint: [url removed, login to view]()). Use the same methods to provide the capability to add new Event classes, and to modify any Event classes without recompiling the Greenhouse class. Note: You should not use inner classes for designing and developing Event classes. Test your program by adding at least two Event classes, and make any necessary changes to greenhouse_plan.txt.
Before the greenhouse restarts everything, it first has to turn off all events. You may need to use ArrayList or Vector to store the events (and scheduling information). Doing so will avoid the need for additional variables to represent different events, and will also allow you to have new Event classes anytime you want.
Browse Related Skills
Other things people do on Freelancer
Looking to make some money?
- Set your budget and the timeframe
- Outline your proposal
- Get paid for your work
Hire Freelancers who also bid on this project
Looking for work?
Work on projects like this and make money from home!Sign Up Now
- The New York Times
- Wall Street Journal
- Times Online