Question: public class Deck { private ArrayList cards; private Random rand; public Deck(int n) { super(); rand = new Random(); cards = new ArrayList (n); for

 public class Deck { private ArrayList cards; private Random rand; public

public class Deck {

private ArrayList cards;

private Random rand;

public Deck(int n) {

super();

rand = new Random();

cards = new ArrayList(n);

for (int suite = 1; suite

for (int rank = 1; rank

if ((suite - 1) * 13 + rank

cards.add(new PlayingCard(rank, suite));

}

}

}

public PlayingCard dealOne() {

return cards.get(rand.nextInt(52));

}

public void shuffle() {

}

public String toString(){

String ret = "";

for (PlayingCard card : cards){

ret += card + " ";

}

return ret;

}

}

Create a method called shuffle_array) in the Deck class which shuffles an array using the method we discussed in in class (sorting an array of random numbers). Do not use the built in Java shuffle methods or any other shuffling algorithm

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!