Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a class (and a client class to test it) that encapsulates a deck of cards.

ID: 3534645 • Letter: W

Question

Write a class (and a client class to test it) that encapsulates a deck of cards. A deck of cards is made up of 52 cards. You should have three instance variables:

-a two-dimensional array of values representing the cards

-a single-dimensional array describing the suit: spades, hearts, diamonds, and clubs

-an instance variable representing the trump suit

(If you don't know a trump is a playing card which is elevated above its normal rank in trick-taking games. Typically an entire suit is nominated as a trump suit - these cards then outrank all cards of plain (non-trump) suits. In other contexts, the term trump card can refer to any sort of action, authority, or policy which automatically prevails over all others.... source wikipedia)

For the two-dimensional array, dimension 1 represents the suit and dimension 2 represents the type of card (ace, two, three, four, five, six, seven, eight, nine, ten, jack, queen, king). Your constructor should take one parameter, which will represent the suit of the trump. Based on that, the cards should be given the following values:

-Non-trump for 2 to 10: 1 point

-Non-trump jack = 2

-Non-trump queen = 3

-Non-trump king = 4

-Non-trump ace = 5

-Any trump card = Non-trump value +1

You should include the following methods:

-a method returning the trump suit, by name

-a method printing the whole deck of cards, suit by suit, with the value for each card

-a method taking a String as a parameter representing a suit, and returning the total value of the cards of that suit

I really need the full source code for this!! thanks for your help!

Explanation / Answer

Contact me on timacs12@gmail.com

you can rate after getting the answer

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote