Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/** * This is a class that tests the Deck class. */ public class DeckTester { /** * The main method in this class checks

/** * This is a class that tests the Deck class. */ public class DeckTester { /** * The main method in this class checks the Deck operations for consistency. * @param args is not used. */ public static void main(String[] args) { String[] ranks = {"jack", "queen", "king"}; String[] suits = {"blue", "red"}; int[] pointValues = {11, 12, 13}; Deck d = new Deck(ranks, suits, pointValues); System.out.println("**** Original Deck Methods ****"); System.out.println(" toString: " + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal a Card ****"); System.out.println(" deal: " + d.deal()); System.out.println(); System.out.println(); System.out.println("**** Deck Methods After 1 Card Dealt ****"); System.out.println(" toString: " + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal Remaining 5 Cards ****"); for (int i = 0; i < 5; i++) { System.out.println(" deal: " + d.deal()); } System.out.println(); System.out.println(); System.out.println("**** Deck Methods After All Cards Dealt ****"); System.out.println(" toString: " + d.toString()); System.out.println(" isEmpty: " + d.isEmpty()); System.out.println(" size: " + d.size()); System.out.println(); System.out.println(); System.out.println("**** Deal a Card From Empty Deck ****"); System.out.println(" deal: " + d.deal()); System.out.println(); System.out.println(); /* *** TO BE COMPLETED IN ACTIVITY 4 *** */ } } The DeckTester.java file, found in the Activity4 Starter Code folder, provides a basic set of Deck tests. It is similar to the DeckTester class you wrote in Activity 2. Add additional code at the bottom of the main method to create a standard deck of 52 cards and test the shuffle method. You can use the Deck toString method to "see" the cards after every shuffle

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions