Starting Out With C++ by Tony Gaddis, (8 Edition PDF Book Shared On Group) Chapter 13 Introduction To Classes
Starting Out With C++ by Tony Gaddis, (8 Edition PDF Book Shared On Group) Chapter 13 Introduction To Classes
Note 1: Do read assignment 3 carefully (You are not required to submit) and cover the concepts, I will take
one or more quiz covering the assignment content from all students.
Note 2: .
Starting Out with C++ by Tony Gaddis, (8th Edition pdf book shared on group)
Chapter 13 Introduction to Classes
Page 807-810: Q 15, Q19, and Q20
Additionally simulate a card game called "Fazool Game." The details are ahead. Put your maximum effort on
design that is create suitable classes and choose appropriate member function for each class.
The card deck contains 52 cards, 13 of each type. At the beginning of the game, shuffle the cards. You need
to devise a fair method for shuffling. (It does not have to be efficient.) After shuffling, present five top cards
to the player. You have to evaluate the turn that is these five cards. Your program should pronounce it one
of the following:
No pair—The lowest turn, containing five separate cards that do not match up to create any of
the turns below
One pair—Two cards of the same value, for example two queens
Two pairs—Two pairs, for example two queens and two 5’s
Three of a kind—Three cards of the same value, for example three queens
Straight—all cards with consecutive values, not necessarily of the same suit, such as 4, 5, 6, 7, and 8.
The ace can either precede a 2 or follow a king
Flush—Five cards, not necessarily in order, of the same kind
Full House—Three of a kind and a pair, for example three queens and two 5's
Four of a Kind—Four cards of the same value, such as four queens
Straight Flush—A straight and a flush: Five cards with consecutive values of the same suit
Royal Flush—A 10, jack, queen, king, and ace, all of the same kind
Guidelines:
- Use "int" array of size 52. Say cards of first types are numbered 1-13, second type are numbered
14-26 and so on. Using integer division by 13 you can get 1,2,3,4 as type and using modulus again
by 13 you can get number from 0 to 12, where 0 is 13 or Ace and 1 is 2
- Shuffling is simple. Generate two random numbers between 0-52 (52 not included) and swap card
numbers like:
n1=...
n2=...
temp=card[n1]
card[n1]=card[n2]
card[n2]=temp
- Use of functions is encouraged. Use static array that is declare out of functions but inside class to
access array in all function without passing
- Write functions for all possible types, you may implement any number of types as per availability of
time.
- Chapter 14 More about Classes
- Page 889: Q14, Q15