The question :
Create a Deck object. The Deck object should have a constructor that creates a deck of cards storing them in a Card field. The Deck object should also have an instance method named display, which displays the contents of the deck. Finally, it should have another instance method named shuffle, which when called, shuffles the deck of cards.
Your program should create an instance of the Deck class, display it in order using the display instance method of the Deck class and then call the shuffle method and display the now shuffled Deck.
String theVals = "2,3,4,5,6,7,8,9,10,J,Q,K,A".split(",");
String theSuits ="Hearts,Diamonds,Clubs,Spades".split(",");
Card theDeck = new Card;
int pos = 0;
for(int i = 0; i < theVals.length; i++)
for(int j = 0; j < theSuits.length; j++)
theDeck[pos] = new Card(theSuits[j], theVals[i]);
public class Card
Card(String suit, String value)
this.suit = suit;
this.value = value;
System.out.println(this.value + " of " + this.suit);
Attached is a detailed explanation... View the full answer