JMU
../DukeDisc.gif
DukeDisc v1


Background
Changes:
Organizing Your Code: You must create a directory/folder named DukeDisc that will contain all of the drivers and the different versions of the various classes. Where you put this directory is up to you.

Inside of the DukeDisc directory/folder you must have six subdirectories/subfolders named v1, v2, v3, v4, v5, and v6.

You must:

  1. Copy Slot.h and Slot.cpp into the v1 directory.
  2. Copy DiscChanger.h and DiscChanger.cpp into the v1 directory.
The Driver: You must download Driver1.cpp and put in in the DukeDisc directory.

This driver is identical to the one used in PA2 except:

  • The PROMPT symbol has been replaced with a bool variable named prompt. Hence, you can no longer control the "verbosity" at compile time.
  • It now #includes the DiscChanger class in the v1 subdirectory.
Changes to the DiscChanger Class: You must modify the DiscChanger class so that it no longer uses the SIZE symbol and instead uses an int variable named size. This involves:
  1. Changing the declaration of the Slot array variable in the header. Instead of using the SIZE symbol it must be hard-coded to a dimension of 6.
  2. Adding a declaration for a private int named size to the header.
  3. Initializing size to 6 in all constructors (in the .cpp file).
  4. Using the variable size in place of the symbol SIZE in the .cpp file.
Other Issues:
Building: It will be very awkward to build the various different versions of DukeDisc without using the make utility since the files will be in many different directories.

The following makefile may prove to be useful in this regard:

# Phony target to build all versions
#
all: v1

# Phony targets for each version
#
v1: Driver1


# 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


# 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
  

The makefile must be in the DukeDisc directory. You can build version 1 of DukeDisc with the command make v1 (assuming the DukeDisc directory is your working directory).

Testing: Even though these are fairly minor modifications, you should test version 1 of DukeDisc. You can use the same tests you used for PA2.

You must keep all test files in the DukeDisc directory and must execute the driver(s) from that directory.

Copyright 2010