Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
private Random rand;
public Deck(int n) {
super();
rand = new Random();
cards = new ArrayList
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 algorithmStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started