Question
The Learning Goal for this exercise is to use and understand and know the difference between arrays and array lists. _Use at least one array
The Learning Goal for this exercise is to use and understand and know the difference between arrays and array lists.
_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, clear the screen when your program runs. I will be posting an example to clear screen method at the end of this page.
__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).
__Go Beyond modify the code to do something fresh. For example, deal 4 hands.
Clear screen method example code:
class myControl { public static void main(String[] args) { cls(); System.out.println("Howdy!"); sleep(5); cls(); System.out.println("Oh, I thought you were someone else."); beep(); sleep(2); System.out.println("GoodBye!"); }// end main
public static void sleep(int s) { try { Thread.sleep(s*1000); } catch(Exception e) { System.out.println("not sleepy"); }//end try }//end sleep
public static void beep() { System.out.println("\007"); }//end beep
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 }// end class
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