tsuPod v2 ... (linked lists)
CS 2308
Completed Program Due: Friday 4/24/15 10:00pm
100 points
Yet again we will be implementing the tsuPod, but this time it will look much different...
For this
program we will be implementing the storage portion of the tsuPod
(pronounced "su Pod" - the much smaller version of the iPod) using a linked list. We will
be storing the following information:
- The head of the linked list (the number of songs is limited only by the amount of memory in the TsuPod)..
- The number of MB of memory will be set when the tsuPod is "constructed"
- You must provide a constructor that will set the size of the memory. The maximum is 512MB.
- The user of the class will pass in a size. If the size is greater than 512MB or less than or equal to 0, set the size to 512MB.
- For each song we will store the title (string), artist (string), and size (int) in MB
- the title and artist cannot be blank
- the size must be greater than zero
You will create your own header and cpp files for the TsuPod and Song classes.
You will create your own driver program. Note: This one should work with your code, but yours will test more things (e.g. sorting).
The following code should work as a makefile. (click this link to download)
final: TsuPod_Driver.o TsuPod.o Song.o
g++ -o test TsuPod_Driver.o TsuPod.o Song.o
driver: TsuPod_Driver.cpp TsuPod.h Song.h
g++ -c TsuPod_Driver.cpp
tsuPod: TsuPod.cpp TsuPod.h Song.h
g++ -c TsuPod.cpp
song: Song.cpp Song.h
g++ -c Song.cpp
All the other rules regarding function return values from the previous TsuPod program still apply.
Things you should do:
- Create classes for TsuPod and Song with appropriate header files.
- here is a start for the TsuPod.h file. You should document it.
- implement methods in the TsuPod class to:
- addSong(Song s)
- removeSong(Song s)
- shuffle() (we will work on this in class)
- showSongList()
- sortSongList() (we will work on this in class)
- getTotalMemory()
- getRemainingMemory()
- implement methods in the Song class to:
- set and get all instance variables
- overload ==, <,and > operators (used in sorting)
- for < and > use artist, then title, then size
NOTES:
- You must do this program by yourself.
- This program must compile and run on Linux. I will provide a makefile that will help with compilation.
- The
program must be done in an object-oriented fashion.
- Upload a zipped
file named tsuPod2_xxxxxx.zip where
xxxxxx is your TXstate id. Make sure your files are named exactly as in the makefile provided (case sensitive). The goal
is that we should be able to unzip the file in a new directory and run
make on it to test the program. You should try this before uploading
the zip file to make sure it works.
Upload: the source file(s) (compressed with zip or tar and zip or gzip if multiple source files) only, on TRACS.
Be sure to follow the style standards for the course.
Updated 4/15/15