Description
CD class
You are provided with a complete CD class with which to use for this assignment. Please download cd.h
and cd.cpp from the course webpage. No modifications will be necessary to these files; methods are
documented in the CD class header file.
CDCatalogue class
You are provided at the course webpage with a fully documented cdcatalogue.h header file which will
not need to be modified. You are to complete the implementation of the CDCatalogue class in a
cdcatalogue.cpp file.
Notes
String Objects
The CD class makes extensive use of string objects. You can find information about the standard string
class at: http://www.cplusplus.com/reference/string/string/ . The main things you need to know about
strings for this assignment are:
You can assign an existing string variable or a string literal to a string variable
o e.g. string str1 = “bob”; or str1 = str2; (where str1 and str2 are strings)
You can use the normal comparison operators (<, >, <=, >=, ==) to compare strings
o You do not need to know anything about the underlying representation of strings – the
operations described above are all you need to do with strings in this assignment.
Geoffrey Tien CMPT 225 – Assignment 1 2
Set Operations
The Join, Common, and Split functions in CDCatalogue are analogous to the set union, intersection,
and difference operations which should be familiar from MACM 101. Recall that:
A set cannot contain duplicate values
The union of two sets R ∪ S is the set of values that appear in either R or S (or in both)
o e.g. {1,3,4,5} ∪ {2,3,4} = {1,2,3,4,5}
The intersection of two sets R ∩ S is the set of values that are common to both R and S
o e.g. {1,3,4,5} ∩ {2,3,4} = {3,4}
The set difference of two sets R − S is the set of values that appear in R but not in S
o e.g. {1,3,4,5} − {2,3,4} = {1,5}
The precise details of duplicate qualification for the purposes of the Join, Common, and Split
functions are documented in cdcatalogue.h.
Function Stubs
If you are unable to complete the functionality of a function, you should still complete a stub so that the
function compiles, although it will not return the correct value. An example stub for the Remove
method:
// Stub for Remove method
bool CDCatalogue::Remove(CD disc)
{
return false;
}
Deliverables
Your submission should include the following files:
A title page listing the name(s) and information of contributing group member(s)
cdcatalogue.cpp
Only one submission is required for a group. Include the above deliverables in a zip archive titled
“assign-1.zip” and upload it to the CourSys submission server.