Purpose: A control system for a multi-disk CD/DVD changer.
Abbreviations, Acronyms:CD | Compact Disc |
DVD | Digital Video Disc and/or Digital Versatile Disc |
About the System: You have been hired to implement the control system for a multi-disk CD/DVD changer. The changer has multiple slots, each of which can hold a single disc. Users have access to only one slot at a time. To move between slots, the changer has two buttons, labeled next and previous. The slots in the changer are arranged in a circle so that the user can continuously cycle through them by pressing these buttons.
The changer also has buttons labeled:
eject: Ejects the disc from the currently selected slot (if it has a disc in it).
ejectAll: Ejects the discs from all slots (starting with the currently selected slot)
getID: Gets the ID number (an integer that is greater than or equal to 1) of the disc in the currently selected slot
loadDisc: Loads a disc into the currently selected slot
off: Turns the power off
on: Turns the power on
Driver
has already
been implemented. The source code is available but
must not be modified.
You must develop the following new components:
A Development Strategy: It will be very difficult to debug the two classes at the same time. Hence, you should:
Slot
class.
Slot
class.
DiscChanger
class.
DiscChanger
class.
Running the Driver: There are several things you might want to consider when running the driver:
As you know, standard input (e.g., cin
) normally
comes from the console. You can redirect a file to standard
input as follows:
Then you can create a file that contains a sequence of commands and avoid the need to type them over and over. (An example is available on-line at test.txt)
PROMPT
.
To compile a verbose version, use:
g++ -c -DPROMPT=1 Driver.cpp
To compile a terse version, use:
g++ -c -DPROMPT=0 Driver.cpp
The terse version is particularly useful when used with re-directed input.
Testing: At a minimum, you should test your code to make sure that it properly handles:
DiscChanger
objects of different sizes
(see the discssion of the "Size of the DiscChanger").DiscChanger
is off.Some tests are available on-line that might help get you started.
Note: You may have trouble moving your test files between machines with different operatings systems. This is because of the way in which an "end of line" is defined.
Late Submission:For this assignment, if your code does not pass the in-lab tests you will have one opportunity to have your code re-tested during the Professor's office hours on the next class-day after the due date (e.g., the Wednesday immediately after the Monday due date). However, you will incur a penalty of 25% (i.e., you will receive a maximum grade of 75).
Copyright 2010