Question: Include screenshots of successful method tests. Must write ArrayStack.java yourself. Lab 6: Uno Stacks We will create a deck of Uno cards and associated methods.

Include screenshots of successful method tests.

Must write ArrayStack.java yourself.

Include screenshots of successful method tests. Must write ArrayStack.java yourself. Lab 6:

Lab 6: Uno Stacks We will create a deck of Uno cards and associated methods. 1. Make a new class UnoCard that contains the following protected data: color (String), and value (String). Make getters and setters for the data, and a tostringO method that returns a string containing the information for that card in a nice format. Make a compare (card) method that returns true if this card (as in this.compare(card)) may be played on top of card. Test the toString) and compare) methods. 2. We plan to use ArrayStack class for many of our Uno piles of cards (hands, pile), but we want a way to shuffle the stack. The data stack is not public in class Since we don't want to alter ArrayStack.java, create your own class discard pile, draw ArrayStack. public class MyArrayStack extends ArrayStack and make a method to shufle the stack. You may use many of the ideas from the RankCardDeck. java class in the support package by the book authors. Test that this works. You will need 3. Create a class UnoStack that contains protected data deck of type MyArraystack Method makeStandardDeck) makes the deck into a standard Uno deck, consisting of 108 constructors for the MyArrayStack class. (of length 150). In addition to the constructor, make the following methods: cards Two of each color with values: 1,2,...,9, Drau2, Reverse, and Skip, - One 0 of each color, and Four Wild cards of each type: no value and Drauf . Method toString) that outputs the stack to a string without destroying it. (Hint: I used a second stack, popped everything off the old stack onto the second stack, and then back, so that the cards would be in the same order . Method shuffle) that can just call the shuffle) method in the MyArrayStack class . Method drawCard) that returns the top card in the stack and takes it off the stack. . Method deal(int nCards) that removes the top nCards cards from this deck, and re- turns a hand (itself of type UnoStack with those cards in it add (UnoCard card) that adds card to this deck. destroyed this. The two original stack2 can be . add (UnoStack stack2) that adds stack2 to Test all these methods. Lab 6: Uno Stacks We will create a deck of Uno cards and associated methods. 1. Make a new class UnoCard that contains the following protected data: color (String), and value (String). Make getters and setters for the data, and a tostringO method that returns a string containing the information for that card in a nice format. Make a compare (card) method that returns true if this card (as in this.compare(card)) may be played on top of card. Test the toString) and compare) methods. 2. We plan to use ArrayStack class for many of our Uno piles of cards (hands, pile), but we want a way to shuffle the stack. The data stack is not public in class Since we don't want to alter ArrayStack.java, create your own class discard pile, draw ArrayStack. public class MyArrayStack extends ArrayStack and make a method to shufle the stack. You may use many of the ideas from the RankCardDeck. java class in the support package by the book authors. Test that this works. You will need 3. Create a class UnoStack that contains protected data deck of type MyArraystack Method makeStandardDeck) makes the deck into a standard Uno deck, consisting of 108 constructors for the MyArrayStack class. (of length 150). In addition to the constructor, make the following methods: cards Two of each color with values: 1,2,...,9, Drau2, Reverse, and Skip, - One 0 of each color, and Four Wild cards of each type: no value and Drauf . Method toString) that outputs the stack to a string without destroying it. (Hint: I used a second stack, popped everything off the old stack onto the second stack, and then back, so that the cards would be in the same order . Method shuffle) that can just call the shuffle) method in the MyArrayStack class . Method drawCard) that returns the top card in the stack and takes it off the stack. . Method deal(int nCards) that removes the top nCards cards from this deck, and re- turns a hand (itself of type UnoStack with those cards in it add (UnoCard card) that adds card to this deck. destroyed this. The two original stack2 can be . add (UnoStack stack2) that adds stack2 to Test all these methods

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!