Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a hierarchical class structure according to the UML 1. Create the following enums: a) Face: includes the 13 faces of a deck of playing

image text in transcribedimage text in transcribed

Create a hierarchical class structure according to the UML 1. Create the following enums: a) Face: includes the 13 faces of a deck of playing cards: ace, two, three... ten, jack, queen, king - include fields: display- the string representation of the face leg. A, 2-10,J,Q,K) points - the point scoring for each face: points face Ace face value 3 to 10 Jack or Queen King b) Suit: includes the suits of a deck of playing cards: clubs, spades, hearts, diamonds Include a display field that is the string representation of the suit. suit Clubs Spades Hearts Diamonds unicode \u2663 \u2660 \u2665 \u2666 2. The Card class has fields suit and a face of types Suit and Face, respectively. include one constructor: full-arg that assigns the passed suit and face Include getters for each and override the toString method to return a string in the format - e.g. [9. 2. K Use StringBuilder to create this string 4. Subclasses Deck and Hand extend the SetofCards class a) Include the following methods in the Deck class: - a no-arg constructor that assigns the max to 52 and creates the deck Include a private utility createCards () that creates and adds all 52 cards in a deck (i.e. each face of each suit). Call this method in the constructor. shuffle() that randomly orders the cards. See the Java documentation for Collections. shuffle deal() removes and returns the first card of the deck Implementation of the evaluate() method: Return a string that indicates the size of the deck b) Include the following methods in the Hand class: a no-arg constructor that assigns the max to 6 - a constructor that assigns the max and an array list of Card objects to cards - evaluate() that returns a String that represents the hand: - Sum of card points (accessed through enum) - Include the scoring for columns of pairs: if matching faces are found within a column, 0 points are scored for each card in that column . toString() override to display in a 3x2 grid (see sample output) - Use StringBuilder to create this string 5. Include a driver class called SixCardGolf that deals 4 hands from the deck and displays the result of each. - Create an instance of a deck - Shuffle the deck of cards, then simulate: - For each player: deal 6 cards from the deck to create a hand - display the cards and the result of the hand - See format in sample output - Display the number of cards remaining in the deck. Create a hierarchical class structure according to the UML 1. Create the following enums: a) Face: includes the 13 faces of a deck of playing cards: ace, two, three... ten, jack, queen, king - include fields: display- the string representation of the face leg. A, 2-10,J,Q,K) points - the point scoring for each face: points face Ace face value 3 to 10 Jack or Queen King b) Suit: includes the suits of a deck of playing cards: clubs, spades, hearts, diamonds Include a display field that is the string representation of the suit. suit Clubs Spades Hearts Diamonds unicode \u2663 \u2660 \u2665 \u2666 2. The Card class has fields suit and a face of types Suit and Face, respectively. include one constructor: full-arg that assigns the passed suit and face Include getters for each and override the toString method to return a string in the format - e.g. [9. 2. K Use StringBuilder to create this string 4. Subclasses Deck and Hand extend the SetofCards class a) Include the following methods in the Deck class: - a no-arg constructor that assigns the max to 52 and creates the deck Include a private utility createCards () that creates and adds all 52 cards in a deck (i.e. each face of each suit). Call this method in the constructor. shuffle() that randomly orders the cards. See the Java documentation for Collections. shuffle deal() removes and returns the first card of the deck Implementation of the evaluate() method: Return a string that indicates the size of the deck b) Include the following methods in the Hand class: a no-arg constructor that assigns the max to 6 - a constructor that assigns the max and an array list of Card objects to cards - evaluate() that returns a String that represents the hand: - Sum of card points (accessed through enum) - Include the scoring for columns of pairs: if matching faces are found within a column, 0 points are scored for each card in that column . toString() override to display in a 3x2 grid (see sample output) - Use StringBuilder to create this string 5. Include a driver class called SixCardGolf that deals 4 hands from the deck and displays the result of each. - Create an instance of a deck - Shuffle the deck of cards, then simulate: - For each player: deal 6 cards from the deck to create a hand - display the cards and the result of the hand - See format in sample output - Display the number of cards remaining in the deck

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions