Create a deck object


Before solving the question please watch the video it has most of the solution at 52 minute. This is the link for the video and try to use the material here make the solution simple do not use new stuff . (https://vimeo.com/groups/175885/videos/61771458 ) 
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.

Sample Code:
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[52];
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]);
pos++;
}




public class Card 
{
//Fields
String suit;
String value;

//Constructors
Card(String suit, String value)
{
this.suit = suit;
this.value = value;
}

//method
void display()
{
System.out.println(this.value + " of " + this.suit);
}

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Create a deck object
Reference No:- TGS093903

Expected delivery within 24 Hours