Write a class and a client class to test it that


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 arrary describing the suit: spades, hearts, diamonds, and clubs

-an instance variable representing the trump suit

For the two-dimensional array, dimension 1 represents the suit and dimension 2 represents the type of card (ace, two, three...,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 follwoing 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

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a class and a client class to test it that
Reference No:- TGS0661560

Expected delivery within 24 Hours