Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a java program of 99 card game. Need answer ASAP The card game 99 (Ninety Nine) is a simple turn-based multiplayer game, where each

image text in transcribedCreate a java program of 99 card game. Need answer ASAPimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

The card game 99 (Ninety Nine) is a simple turn-based multiplayer game, where each player takes a turn playing a card from their hand, and adds the value of the card to the running total. The player who causes the total to go over 99 loses the round. . Create a program that simulates a round of 99: Players are dealt 3 cards. The point total starts at zero and each card adds its face value in points (example: a 5 is worth five points, a face card is worth 10 points) except for certain cards that have special values or meanings: A 4 reverses play (and does not change the total number of points) A9 is a pass (and does not change the total number of points) A 10 subtracts 10 points from the total A King takes the point total to 99 (or keeps it 99 if the total is already 99) An Ace adds either 1 or 11 points, announced by the player who plays it After each card is played, the player announces the new total to the table and draws a replacement card. Each player must play a card without sending the total number of points higher than 99. If a player cannot play a card that keeps the total at or less than 99, that player loses a token and the round ends. 1. Develop a generic CircularDoublyLinkedList Use the circularly and doubly linked list classes from our notes as a basis. Start with the DLL and think of how it can work circularly. Sentinels are not required, only a reference to the last node Node will have references to the next and previous nodes addbetween and remove () private utilities will be used, all adding and removing will work like doubly A boolean field, is Forwaro, represents the direction of rotation Your Circular Doublelinked List class will support the following public methods: size() Returns the number of elements in the list. isEmpty() Returns true if the list is empty, and false otherwise. first() Returns (but does not remove) the first element in the list. last) Returns (but does not remove) the last element in the list. aadFirst(e) Adds a new element to the front of the list. aodlast (c) Adds a new element to the end of the list. removeFirst() Removes and returns the first element of the list. removeLast.() Removes and returns the last element of the list. rotate() Advances to the next element in the list based on direction roversco Changes the direction 2. Create the following classes: 1 GameSim 1 is played with Deck 1 involves v consists of 1 * Player Card plays > a) Card contains 2 enum types: Suit: CLUBS, SPADES, HEARTS, DIAMONDS RANK: numbers TWO to TEN, JACK, QUEEN, KING, ACE b) Deck stores an ArrayList (from Java API) of Cards Upon initialization a deck of 52 cards should be built. create and add all 52 cards in a deck (i.e. each rank of each suit). Include a shuffle () method that shuffles the cards Include a method that removes a card from the top (front) of the deck and returns the Card instance c) Player stores the player name and an ArrayList of Cards as their hand. Include a method to play a card (removes and returns a given card from the hand). d) Game S ir class that runs the game *Note - most of the work will be done here. AsiPartA_Driver should have minimal code: e.g. declare/create a GameSim instance, add players, initiate game play. Fields: a CircularDoublyLinkedList of players a Deck of cards the running total of the round any other field required to manage the game Upon instantiation of a game, set up the list of players (use 4 players for your demo/sample data), create the deck, shuffle and deal 3 cards to each player. Begin the game with the first player in the list. Each player will have their turn when positioned at the head of the list. Notes: Use enhanced enums to set the value for a face card. Mark special cards through this value. If the player plays an ACE, play 11 unless it will cause them to lose the round. When faced with possibly going over 99, the player should play a card that prevents them from losing. Otherwise any card can be played. - Note in the sample output below, the first card in the hand is played. To format output, include a String field display and override the enum's toString(). Use unicode values \u2663, \u2660, \u2665, \u2666 for clubs, spades, hearts and diamonds respectively. Sample output: Let's play 99!!! Players: Simba, Nala, Timon, Pumbaa (Simba's hand: 104, 6, c) smoa plays 104 The total is -10 2, 5) (Nala's hand: 24, Nala plays A The total is 1 (Timon's hand: 44, 4., 5.) Timon plays 16 Gama TOVCTES direction (Nala's hand: 2,5 Nala plays 2 The Lolal is 3 (Simba's hand: 69, 0., K.) Simoa plays 6W The total is 9 (Pumbaa's hand: 104, 9, 8) Purbaa plays 104 The total is -1 (Simon's hand: 4., 5., 9) Timon plays 4. Game reverses direction (Plummoaa's hand: 9., 8., 9) Pumbaa plays 9. simba skips a turn (Nala's hand: 5, K, 59) Nala plays 5 The total is 4 (imon's hand: 5., 9, 34) Timon plays 5. The total is 9 (Purbaa's hand: 8., 0, 6.) Pumoaa plays 8. The total is 17 (Simba's hand: 0., K., 3) s_mba plays 0 The total is 27 (Nala's hand: K, 5., 3.) Nala plays K The total is 99 (Timon's hand: 9, 34, 3+) Timon plays 9 Pumbaa skips a turn (Simba's hand: K, 3, 10) Simba plays K The total is 99 (Nala's hand: 54, 34, 2) Nala plays 54 The total is 104 Nala loses this round The card game 99 (Ninety Nine) is a simple turn-based multiplayer game, where each player takes a turn playing a card from their hand, and adds the value of the card to the running total. The player who causes the total to go over 99 loses the round. . Create a program that simulates a round of 99: Players are dealt 3 cards. The point total starts at zero and each card adds its face value in points (example: a 5 is worth five points, a face card is worth 10 points) except for certain cards that have special values or meanings: A 4 reverses play (and does not change the total number of points) A9 is a pass (and does not change the total number of points) A 10 subtracts 10 points from the total A King takes the point total to 99 (or keeps it 99 if the total is already 99) An Ace adds either 1 or 11 points, announced by the player who plays it After each card is played, the player announces the new total to the table and draws a replacement card. Each player must play a card without sending the total number of points higher than 99. If a player cannot play a card that keeps the total at or less than 99, that player loses a token and the round ends. 1. Develop a generic CircularDoublyLinkedList Use the circularly and doubly linked list classes from our notes as a basis. Start with the DLL and think of how it can work circularly. Sentinels are not required, only a reference to the last node Node will have references to the next and previous nodes addbetween and remove () private utilities will be used, all adding and removing will work like doubly A boolean field, is Forwaro, represents the direction of rotation Your Circular Doublelinked List class will support the following public methods: size() Returns the number of elements in the list. isEmpty() Returns true if the list is empty, and false otherwise. first() Returns (but does not remove) the first element in the list. last) Returns (but does not remove) the last element in the list. aadFirst(e) Adds a new element to the front of the list. aodlast (c) Adds a new element to the end of the list. removeFirst() Removes and returns the first element of the list. removeLast.() Removes and returns the last element of the list. rotate() Advances to the next element in the list based on direction roversco Changes the direction 2. Create the following classes: 1 GameSim 1 is played with Deck 1 involves v consists of 1 * Player Card plays > a) Card contains 2 enum types: Suit: CLUBS, SPADES, HEARTS, DIAMONDS RANK: numbers TWO to TEN, JACK, QUEEN, KING, ACE b) Deck stores an ArrayList (from Java API) of Cards Upon initialization a deck of 52 cards should be built. create and add all 52 cards in a deck (i.e. each rank of each suit). Include a shuffle () method that shuffles the cards Include a method that removes a card from the top (front) of the deck and returns the Card instance c) Player stores the player name and an ArrayList of Cards as their hand. Include a method to play a card (removes and returns a given card from the hand). d) Game S ir class that runs the game *Note - most of the work will be done here. AsiPartA_Driver should have minimal code: e.g. declare/create a GameSim instance, add players, initiate game play. Fields: a CircularDoublyLinkedList of players a Deck of cards the running total of the round any other field required to manage the game Upon instantiation of a game, set up the list of players (use 4 players for your demo/sample data), create the deck, shuffle and deal 3 cards to each player. Begin the game with the first player in the list. Each player will have their turn when positioned at the head of the list. Notes: Use enhanced enums to set the value for a face card. Mark special cards through this value. If the player plays an ACE, play 11 unless it will cause them to lose the round. When faced with possibly going over 99, the player should play a card that prevents them from losing. Otherwise any card can be played. - Note in the sample output below, the first card in the hand is played. To format output, include a String field display and override the enum's toString(). Use unicode values \u2663, \u2660, \u2665, \u2666 for clubs, spades, hearts and diamonds respectively. Sample output: Let's play 99!!! Players: Simba, Nala, Timon, Pumbaa (Simba's hand: 104, 6, c) smoa plays 104 The total is -10 2, 5) (Nala's hand: 24, Nala plays A The total is 1 (Timon's hand: 44, 4., 5.) Timon plays 16 Gama TOVCTES direction (Nala's hand: 2,5 Nala plays 2 The Lolal is 3 (Simba's hand: 69, 0., K.) Simoa plays 6W The total is 9 (Pumbaa's hand: 104, 9, 8) Purbaa plays 104 The total is -1 (Simon's hand: 4., 5., 9) Timon plays 4. Game reverses direction (Plummoaa's hand: 9., 8., 9) Pumbaa plays 9. simba skips a turn (Nala's hand: 5, K, 59) Nala plays 5 The total is 4 (imon's hand: 5., 9, 34) Timon plays 5. The total is 9 (Purbaa's hand: 8., 0, 6.) Pumoaa plays 8. The total is 17 (Simba's hand: 0., K., 3) s_mba plays 0 The total is 27 (Nala's hand: K, 5., 3.) Nala plays K The total is 99 (Timon's hand: 9, 34, 3+) Timon plays 9 Pumbaa skips a turn (Simba's hand: K, 3, 10) Simba plays K The total is 99 (Nala's hand: 54, 34, 2) Nala plays 54 The total is 104 Nala loses this round

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

More Books

Students also viewed these Databases questions

Question

Are two NP-complete questions mutually reducible to each other?

Answered: 1 week ago

Question

4. Describe cultural differences that influence perception

Answered: 1 week ago