Problem Set 5: CS 52: C++ Programming Section # 4120 Problem Set 5 - Fall, 2010 Due October 27, 2010 6:40 PM
Problem Set 5: CS 52: C++ Programming Section # 4120 Problem Set 5 - Fall, 2010 Due October 27, 2010 6:40 PM
Problem Set 5: CS 52: C++ Programming Section # 4120 Problem Set 5 - Fall, 2010 Due October 27, 2010 6:40 PM
Problem Set 5
Directions:
All problem sets need to be submitted electronically, via e-mail. Code for this assignment needs to
be two cpp files named ps5_LastName_FirstName_ A.cpp (Part A) and
ps5_LastName_FirstName_B.cpp (Part B). Both files may be zipped in to a single zip file called
ps5_LastName_FirstName.zip.
The subject line of the e-mail must read cs 52 ps5 LastName FirstName (e.g. cs52 ps5 Brown Nik).
Background:
The purpose of this assignment is to get practice working with classes. We will cover how to
approach this problem set logically as well as the syntax of all the statements needed to do this
problem set in class.
Note the above is a question on the midterm. In addition to declaring this class (the midterm
question) you must implement the member functions for this class.
CardDeck() {
// The constructor CardDeck() will initialize deckSize to 54, currentCard to 0, numPerSuit to 9; the
initial suit 'A' and create a dynamic array pointed to by arrPtr filled with the card deck. The values
on the card will be 1-9 and the suits A, B, C, etc. until the deck deckSize is filled. In other words a
deckSize of 54 would be 54/9 or 6 suits 1A, 2A, etc. through 9F
}
CardDeck(int n) {
/// Same as above, CardDeck(), but any number of cards greater than 1 can be set to the deckSize.
}
~CardDeck() {
// Need to clean up any dynamic data, if any?
}
void PrintDeck() {
// Print the deck in its current order.
}
void PrintCard() {
// Print the currentCard as indicated by current card.
}
void NextCard() {
// Appropriately increment currentCard.
}
void Shuffle() {
// Shuffle the deck. Calls to PrintDeck() then Shuffle() then PrintDeck() should have very different
orderings.
}