JMU
../DukeDisc.gif
DukeDisc v4


Background
About the System: In version 4 of DukeDisc, the size of the DiscChanger and the "verbosity" of the TextInterface are passed to the driver as command-line arguments.
Changes to Existing Code:
The Driver: You must write a driver named Driver4.cpp (that must be in the DukeDisc directory). The only difference between this driver and Driver3.cpp is that it is passed two command-line parameters, the the size of the DiscChanger and "verbosity" of the TextInterface (in that order).

It must convert the first parameter to an int and pass it to the constructor of the DiscChanger. [Notes: (1) You may assume that it will be possible to convert this parameter to an int. However, if the resulting int is less than or equal to 0, the default constructor in the DiscChanger class must be used. (2) Different operating systems may order the arguments differently. You will need to check to make sure that you are working with the correct arguments.]

If the value of the second parameter is "terse" then the driver must pass a value of false to the constructor of the TextInterface. Otherwise it must pass a value of true.

Other Issues:
Useful Functions: The atoi() function can be used to convert a C-style string (i.e., a char array) to an int. The strcmp() function can be used to compare two C-style strings. Both of these functions are in the string library.
Building: The following makefile may prove to be useful in this regard:
# Phony target to build all versions
#
all: v1 v2 v3 v4

# Phony targets for each version
#
v1: Driver1
v2: Driver2
v3: Driver3
v4: Driver4

# Drivers
#
Driver1: Driver1.o v1/DiscChanger.o v1/Slot.o
	g++ Driver1.o v1/DiscChanger.o v1/Slot.o -o Driver1

Driver1.o:  Driver1.cpp v1/DiscChanger.h
	g++ -c Driver1.cpp

Driver2: Driver2.o v2/TextInterface.o v1/DiscChanger.o v1/Slot.o
	g++ Driver2.o v2/TextInterface.o v1/DiscChanger.o v1/Slot.o -o Driver2

Driver2.o:  Driver2.cpp v2/TextInterface.h v1/DiscChanger.h 
	g++ -c Driver2.cpp

Driver3: Driver3.o v2/TextInterface.o v3/DiscChanger.o v1/Slot.o
	g++ Driver3.o v2/TextInterface.o v3/DiscChanger.o v1/Slot.o -o Driver3

Driver3.o:  Driver3.cpp v2/TextInterface.h v3/DiscChanger.h 
	g++ -c Driver3.cpp

Driver4: Driver4.o v2/TextInterface.o v3/DiscChanger.o v1/Slot.o
	g++ Driver4.o v2/TextInterface.o v3/DiscChanger.o v1/Slot.o -o Driver4

Driver4.o:  Driver4.cpp v2/TextInterface.h v3/DiscChanger.h 
	g++ -c Driver4.cpp



# v1 of DiscChanger and Slot
#
v1/DiscChanger.o: v1/DiscChanger.cpp v1/DiscChanger.h v1/Slot.h
	g++ -c v1/DiscChanger.cpp -o v1/DiscChanger.o

v1/Slot.o: v1/Slot.cpp v1/Slot.h
	g++ -c v1/Slot.cpp  -o v1/Slot.o



# v2 of TextInterface
#
v2/TextInterface.o: v2/TextInterface.cpp v2/TextInterface.h
	g++ -c v2/TextInterface.cpp -o v2/TextInterface.o



# v3 of DiscChanger
#
v3/DiscChanger.o: v3/DiscChanger.cpp v3/DiscChanger.h v1/Slot.h
	g++ -c v3/DiscChanger.cpp -o v3/DiscChanger.o

  

You can build version 3 of DukeDisc with the command make v3.

Testing: You can use the same tests you used for v1.

Copyright 2010