Question: PART B Program your remote control application to read from a configuration file and write to a log file. Your program will now require two
PART B
Program your remote control application to read from a configuration file and write to a log file.
Your program will now require two new Singleton classes:
i Configuration: Upon instantiation, two pieces of information from the
RemoteConfig.txt file are read and stored in the following fields:
numberOfOptions: the number of options to set the remote control
height: the height of the remote control in pixels
Required methods: accessors for the two fields.
The RemoteControlApp will use this information to set up the GUI.
ii Logger: Logs every command with the current date and timestamp.
Required method: log that accepts a string name of the command as a parameter.
The abstract Command class will have new methods
logCommand that passes the class name to the Logger Singleton for logging
executeWithLog that calls execute and logCommand
undoWithLog that calls undo and logCommand
The Command hierarchy will also implement the Template Method pattern.
Produce the following design diagrams:
a The new class diagram that includes the Singleton and Template Method patterns
described above
b The sequence diagram for the following commands: Light Room Light On Ceiling Fan
Medium, Stereo with radio On Undo, Undo, Redo
Note that you do not have to incorporate the messages regarding cloning: focus
on the messages that illustrate the design patterns involved
Implement your design.
Since there is no multithreading in this application, use lazy instantiation for your Singletons.
Use the Configuration getters to set the constants in RemoteApplicationApp.
FileWriter can be used for the logger Use the stop method of Application to
invoke a method to close the file upon exiting the application.
RemoteControl must now call the new template methods executeWithLog and
undoWithLog
Load your final remote with the following commands for submission note that your remote
should work with any possible command settings based on the set of commands built:
Living Room Light
Stereo with radio
Stereo with CD Loud
Ceiling Fan medium
Ceiling Fan low
Macro named Workout with Living Room Light on Stereo with CD Ceiling Fan high.
Notes:
Ceiling fan must be added see your sample code for the Command pattern Stereo
commands must be updated to include states.
The clone method must be overridden in the abstract command class. All concrete
classes will use this method, there should be no duplicated code across concrete classes.
Suggested steps for implementation:
AddEdit required commands
Implement simple undo level to test commands
Load the remote with commands that you want to test ie Stereo states
Add the undo call in RemoteControlApp
Override the clone method
You will have to handle exceptions at the call in the RemoteControlApp
Work the unlimited undoredo into the RemoteControl class
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
