Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Technology

Authors: Suad Alagic

1st Edition

354096276X, 978-3540962762

More Books

Students also viewed these Databases questions

Question

Explain the need for and importance of co-ordination?

Answered: 1 week ago

Question

Explain the contribution of Peter F. Drucker to Management .

Answered: 1 week ago

Question

What is meant by organisational theory ?

Answered: 1 week ago

Question

What is meant by decentralisation of authority ?

Answered: 1 week ago