Question: java assistance Create a class named Card (this will represent a standard playing card). The fields for the Card are the suit, the face (what

java assistance

Create a class named Card (this will represent a standard playing card). The fields for the Card are the suit, the face (what you see, ie: 2,3 K) and a value. The Jack, Queen and King have a value of 10, the Ace has a value of 11. Write an equals( ) method based on the suit and face, a compareTo( ) method based on the value field and a toString( ) method along with the constructor method, that takes a value for each of the three fields, and get( ) methods. Then write a class named Deck. This class will represent a deck of 52 playing cards. The constructor method must create 52 Card instances to populate the array. Write a toString( ) method that returns the contents in a textual format of the entire deck of cards. Use the StringBuilder class to build the string, then convert to a String by using the constructor of the String class that accepts a StringBuilder reference. Test your class by writing a short driver that creates a Deck instance and prints the contents of the Deck instance. Then, in the Deck class write a shuffle method that swaps elements in the array in a loop that repeats 1000 times. Test this in the driver again by printing the deck after calling the shuffle( ) method.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!