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

im having trouble with this coding question for java Write a class (and a client

ID: 3534625 • Letter: I

Question

im having trouble with this coding question for java

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 saw that this question was already asked but i didnt see an answer for it.

Explanation / Answer

Please rate with 5 stars :)


You need this. It gives all the details.


Reference :


http://math.hws.edu/javanotes/c5/s4.html