Question: Playing Card Lab Write a program which demonstrates playing cards. Develop your program incrementally, in two steps: 1) Create an enumerated type Suit with values
Playing Card Lab Write a program which demonstrates playing cards. Develop your program incrementally, in two steps: 1) Create an enumerated type Suit with values { Club, Diamond, Heart, Spade . Write a class named Card with these private member fields: int number-1 stands for an Ace, 11 for Jack, 12 for Queen, 13 for King Suit suit and these public member methods: Card int n, Suit s )- constructor- initializes number and suit .int getNumbert()-returns the number of the Card object Suit getSuit()-returns the suit of the Card object Demonstrate Card with a main program which: .Creates two Card objects from user input for suit and number . Prints"Two of a kindl" if cards have the same number . Prints "Flush!" if cards have the same suit You cannot directly input an enumerated value. Instead you must input an integer, character, or string, and convert it to suit. 2) After part 1 is complete and running correctly, add these members to your class . String description -for example "Spade 10" or "Diamond Queen void setDescription)-generates description from the card's number and suit . String getDescription)-returns the description of the card. Call setDescription) in your constructor, after number and suit are initialized. Then print the description in the main program, after the Card objects are created
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
