Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need someone to complete the rest of these code files please The code files are as follows: package cardgameweek4; /** * Starter code for the

Need someone to complete the rest of these code files please image text in transcribed

The code files are as follows:

package cardgameweek4; /** * Starter code for the Card class. * To be used in Week 4. * @author dancye, 2019 */ public class Card { public enum Suit {HEARTS, CLUBS,SPADES,DIAMONDS}; public enum Value{ACE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING}; private final Suit suit; private final Value value; public Card(Suit s, Value gVal) { suit =s; value= gVal; } public Value getValue() { return this.value; }

public Suit getSuit() { return this.suit; } }

-----------------------------------------------------------------------------

package cardgameweek4; /** * a class that models the Card Hand. * A Card hand has an array of cards. * How can you change the size of the hand? how big is it right now? * @suthor dancye, 2019. */

public class CardHand {

private int handSize = 52; public Card[] cards = new Card[handSize];

/** * Add comments during class to explain what this method does. */ public void generateHand() { int countCards = 0; for(Card.Suit s: Card.Suit.values()) { for(Card.Value v: Card.Value.values()) { cards[countCards] = (new Card(s,v)); countCards++; } }//end outter for }//end method

}

---------------------------------------------------------------------------------

package cardgameweek4; /** * A class to handle the user interaction for the Card * project. Contains a main method that generates a card hand * and then iterates over it to print its contents to the console. * @author dancye, 2019 */ public class GamePlayer {

public static void main(String[] args) { CardHand ch = new CardHand(); ch.generateHand(); for(Card c: ch.cards) { System.out.println(c.getValue() + " of " + c.getSuit()); } // System.out.println(ch.cards); show what happens when there is no toString() }

}

AutoSave AA SU ICE 2_updated 02 Home Insert Draw Design Layout References Mailings Review View RCM Acrobat Tell me Share Comments Adv av +=+ MOROCCDI AAROCCDI AABE AABBOCC AaBoCc Acace AGD ccca - Pauli B Marina ! Cals Bubal H: | F2 La. CHANN AU PAIN Syrului The tasks below will convert your original ICE 2 Card code that modelled a deck of standard playing cards into a program that is ready to modelo deck of Uno cards. For our gome, we will model the Uno deck as folows: 4 colours, red, yellow, green, blue Ranks 0-9 for each colour + skip, reverse, draw two, draw four and wildcard for cach colour = (10+5) for each colour . So in total = 15x4 - 60 cards TASK 1. if you need a base for your code, clone the ICE2 Repository civen you will not need to push anything to the repository for this ICE** 2. Edit the Card class so that the Cards could now be used as Uno cards as described above. 3. Create a UML class diagram showing your new Card class and one for each enum you have used in Visual Peradigm 4. In the class-level comments for your Cord class, describe one oO principle that allowed you to reuse your original Card code and extend it to become an Uno deck 5. Also in your class level comment of your Card class, describe one feature of the code that wil allow your Card closs to be reused or extended in another program. 6. Submit your completed class diagrams and your source code for the Card class (with comments for Tasks 4 and 5) in a .zip file to the DropBox. Submissions not in zip format will not be evaluated. rescos 5C6 wards x English (United States Focus 503 AutoSave AA SU ICE 2_updated 02 Home Insert Draw Design Layout References Mailings Review View RCM Acrobat Tell me Share Comments Adv av +=+ MOROCCDI AAROCCDI AABE AABBOCC AaBoCc Acace AGD ccca - Pauli B Marina ! Cals Bubal H: | F2 La. CHANN AU PAIN Syrului The tasks below will convert your original ICE 2 Card code that modelled a deck of standard playing cards into a program that is ready to modelo deck of Uno cards. For our gome, we will model the Uno deck as folows: 4 colours, red, yellow, green, blue Ranks 0-9 for each colour + skip, reverse, draw two, draw four and wildcard for cach colour = (10+5) for each colour . So in total = 15x4 - 60 cards TASK 1. if you need a base for your code, clone the ICE2 Repository civen you will not need to push anything to the repository for this ICE** 2. Edit the Card class so that the Cards could now be used as Uno cards as described above. 3. Create a UML class diagram showing your new Card class and one for each enum you have used in Visual Peradigm 4. In the class-level comments for your Cord class, describe one oO principle that allowed you to reuse your original Card code and extend it to become an Uno deck 5. Also in your class level comment of your Card class, describe one feature of the code that wil allow your Card closs to be reused or extended in another program. 6. Submit your completed class diagrams and your source code for the Card class (with comments for Tasks 4 and 5) in a .zip file to the DropBox. Submissions not in zip format will not be evaluated. rescos 5C6 wards x English (United States Focus 503

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

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions