Starting from:
$30

$24

Lab 3 Getting Practice with Classes Solved


In order to get credit for the lab, you need to be checked off by the end of lab. You can earn a maximum of 10 points for lab work completed outside of lab time, but you must finish before the next lab. For extenuating circumstances, contact your lab TAs and the instructor.

For this lab we would like to create the pieces necessary to make a variety of card games using a standard 52 card deck of playing cards.

(5 pts) Card Class

Design and create the .h and .cpp files with accessors and mutators for a Card class. Cards have two properties, suit and rank. The four possible suits are diamonds, clubs, hearts, and spades. There are 13 possible ranks, with the 11 corresponding to "Jack", 12 corresponding to "Queen", 13 corresponding to


"King", and 1 corresponding to "Ace".

(5 pts) Deck Class

Design and create the .h and .cpp files with accessors and mutators for a Deck class. Decks are made up of 52 Cards. The Deck class should have functions for creating the deck (filling it with the traditional 52 cards), shuffling the cards, and printing the entire deck out to the terminal.

(http://www.cplusplus.com/reference/fstream/fstream/)

(4 pts) Implementation

Now, create a driver.cpp file that creates a deck, shuffles the cards, and prints out the results.

(1 pt) Makefile

Create a Makefile that compiles all of your .cpp and .h files and makes an executable showing off their functionality.

Remember, you will not receive lab credit if you do not get checked off by the TA before leaving each lab. Once you have a zero on a lab, then it cannot be changed because we have no way of knowing if you were there or not!

More products