Menu

[Solved]Java Get Started Create Class Called Card Card Three Fields Value Suit Face Card Class Con Q37124648

In java

How to get started;

Create a class called Card. The card has threefields; a value , a suit and a face.

The card class has a constructor that takes three values for thethree fields.

Create a no-args constructor.
The Card class has three get methods to return the values of eachof the fields.

The Card class has a toString( ) method.

The Card class has a compareTo( ) method that uses the value ofthe card to determine the ordering.

Create an equals( ) method that returns true if the parameterCard has the same suit and the same face as the invoking Card.

Create a class called Deck. A deck has twofields- an array of Cards and an int which holds the subscript ofthe Card at the top of the deck.
The Deck class will have only one constructor, which will createthe array. Try to think of a way to code this without writing 52statements. (not required)

The Deck class also has a method getTopCard( ) which returns acopy of the Card that is at the top of the array.Notice this means the Card class needs a copy constructor.

The Deck class has a method called shuffle( ) which shuffles thearray of Cards. To shuffle, generate random numbers and use theseto exchange array elements. Exchange 1000 times in this method.

Display a test of your Card class and Deck class in a main( )that

Prints the entire Deck before shuffling, prints the Deck after ashuffle and

Draws and prints the top two Cards.

Expert Answer


Answer to In java How to get started; Create a class called Card. The card has three fields; a value , a suit and a face. The card… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *