Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment requires you to download the following files through Canvas: Card.java and DeckMethods.java . Please look them over, they are self-explanatory: Card represents a

This assignment requires you to download the following files through Canvas: Card.javaimage text in transcribedand DeckMethods.javaimage text in transcribed. Please look them over, they are self-explanatory: Card represents a playing card and DeckMethods.java provides methods to manipulate an array of instances of the class Card.java.

This assignment requires that you write a program (name it DemoCard.java) that will create an array of cards, populate that array with instances of the class card (a standard deck), shuffle that array, create two additional arrays of cards of size 5 and place 5 cards from the original shuffled array into each of the two new arrays, alternating between the two new arrays. The methods in the class DeckMethods provide all that you need to do this - use those methods. In plain English you are creating a deck of cards, shuffling that deck, and then dealing 5 cards to two different players. You are then to sort the two arrays that were dealt by the int stored in the instance variable value (you will have to write your own code for this - the methods in the Arrays class will not help you, and there is no Sort method in the DeckMethods class.

You are to use the methods of the class DeckMethods as much as possible.

Here is an outline of the steps you could take:

//declare and create an array of 52 cards - name it deck

//populate deck with instances of the class card - making a complete deck of cards

//print the array deck

//shuffle the array deck

//print the array deck (which is now shuffled)

//declare and create two arrays of Cards each of length 5 name one array player1 and the other player2

//deal (by using the method pop) alternating cards from deck, adding them to the arrays player1 and player2 - you are dealing 5 cards to each player //alternating between the players

//print the arrays player 1 and player2

//sort the arrays player1 and player2 based on the int stored in the instance variable - you will have to create your own method for this

//print the arrays player1 and player2

Transcribed image text

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

More Books

Students also viewed these Databases questions