Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Class Card should provide: a . Data members face and suit of type int. These are index numbers for the faces and suits arrays described

Class Card should provide:
a.
Data members face and suit of type int. These are index numbers for the faces and suits arrays described in step c below.
b.
A constructor that receives two ints representing the face and suit and uses them to initialize the data members.
c.
Two static arrays of strings representing the faces and suits. The faces array stores the strings Ace,Deuce,Three,Four,Five,Six,Seven,Eight,Nine,Ten,
Jack,Queen, and King. The suits array stores the strings Hearts,Diamonds,
Clubs, and Spades.
d.
A toString function that returns the Card as a string in the form face of suit. For example, Ace of Hearts. You can use the + operator to concatenate strings.
Class DeckOfCards should contain:
a.
A vector of Cards named deck (of type Card the Card class) to store the Cards. There are 52 cards in a deck, which is the number of faces (13) times the number of suits (4).*
b.
An integer currentCard representing the next card to deal. This is used as an index number for the deck vector from step a.
c.
A default constructor that initializes the Cards in the deck. You can initialize the faces and suits in the order shown above in step c of the Card class.**
d.
A shuffle function that shuffles the Cards in the deck. The shuffle algorithm should iterate through the array of Cards. For each Card, randomly select another Card in the deck and swap the two Cards.
e.
A dealCard function that returns the next Card object from the deck vector.
f.
A moreCards function that returns a bool value indicating whether there are more Cards to deal. This function will return false if all 52 cards have been dealt, otherwise it returns true.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

=+ Does this site have scientific, medical, or legal advice?

Answered: 1 week ago