Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Learning about Arrays and Array lists. The Learning Goal for this exercise is to use and understand and know the difference between arrays and array

Learning about Arrays and Array lists.

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 given in class, clear the screen when your program runs.(I am providing you an example code for 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.

Example Code for clear screen method:

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

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

Database And Expert Systems Applications 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions

Question

List the advantages and disadvantages of the pay programs. page 505

Answered: 1 week ago