Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use at least one array defined in your code and two array lists defined by the operation of your code. The array should be 52
Use at least one array defined in your code and two array lists defined by the operation of your code. The array should be 52 elements and contain a representation of a standard deck of cards, in new deck order. (This is the order of a deck of cards new from the box.)
The 2 Array lists can be looked at as a draw deck and a hand deck. The original array is used to populate the draw deck before dealing.
- Write and use a method to build a deck of cards where the array of cards is available in Main.
- Use the clear screen method given in class, clear the screen when your program runs. (available on the class web page in myControls.java
- Use heading or titles and make the output look nice.
- Back in Main, print out the cards, 4 per line, 1 suit per column. (using a loop might help)
- Use the deck array to create an array list of cards and be able to shuffle those cards.
- Print out the shuffled deck.
- Deal out 5 cards to another array list and the remaining cards should be the draw pile. (you will be taking cards from one ArrayList and adding it to another.)
- Print both the hand (5 cards) and the draw deck (47 cards).
public static void cls() { if (System.getProperty("os.name").contains("Mac")) { System.out.println("\033[H\033[2J"); }else{ try { new ProcessBuilder("cmd","/c","cls").inheritIO().start().waitFor(); } catch(Exception e) { System.out.println("Error?"); }//end try }//end if }// cls
Step 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