Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Deck of Cards Lab Create and display a deck of 52 cards: 1) Begin with your Card class from the Card Class Lab. Write a

image text in transcribed
image text in transcribed
image text in transcribed
Deck of Cards Lab Create and display a deck of 52 cards: 1) Begin with your Card class from the Card Class Lab. Write a new main program which creates a deck of cards as a two-dimensional array deck[41[13]. Display the deck like this: Diamond Ace Diamond2 Diamond 3 Diamond 4 Diamond 5 Diamond6 Diamond 7 Diamond 8 Diamond 9 Diamond 10 Diamond Jack Diamond Queen Diamond King Club Ace Club 2 Club 3 Club 4 Club 5 Club 6 Club 7 Club 8 Club 9 Club 10 Club Jack Club Queen Club King Heart Ace Heart 2 Heart 3 Heart 4 Heart 5 Spade Ace Spade 2 Spade 3 Spade 4 Spade S Spade 6 Spade 7 Spade 8 Spade 9 Spade 10 Spade Jack Spade Queen Spade King Heart 6 Heart 7 Heart 8 Heart 9 Heart 10 Heart Jack Heart Queen Heart King 2) Separate your class definition and main program from part 2 into two files. Ensure you can build and run your program. 3) Rewrite your main program using a vector for deck rather than a two-dimensional array. Do you prefer vectors or arrays for this problem? Why? #include using namespace std; void setDescription) class card private: int number; int suit; string description; public: int getNumber) (return number;) int getSuit) freturn suit; card( int n, int s) number ni suit - sih void setDescription) string obj1; if(number1) obj1 - "ace" else if(number-11) obj 1 "jack". else if (number 12) obj1 "queen"; else if (number t- 13) obj1 "king" else obj1 t0-string (number); string obj2; if (suit 0) 0 string obj2; if (suit0) 0 obj2 "club"; if(suit 1) 6 obj2 "diamonds" 58 if (suit 2) 50 obj2 "hearts"; if(suit 3) 62 35 obj2 "spades" 86 description obj1 + obj2; 69 70 71 72 73 74: string getDescription) return description;h

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

Database And Expert Systems Applications Dexa 2022 Workshops 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 In Computer And Information Science 33

Authors: Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil ,Bernhard Moser ,Alfred Taudes ,Atif Mashkoor ,Johannes Sametinger ,Jorge Martinez-Gil ,Florian Sobieczky ,Lukas Fischer ,Rudolf Ramler ,Maqbool Khan ,Gerald Czech

1st Edition

3031143426, 978-3031143427

More Books

Students also viewed these Databases questions

Question

Explain the chemical properties of acids with examples.

Answered: 1 week ago

Question

Write the properties of Group theory.

Answered: 1 week ago