Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this milestone, you will create a Player class to model the behavior of a poker player. Each poker player must keep track of his/her

In this milestone, you will create a Player class to model the behavior of a poker player. Each poker player must keep track of his/her hand, fund balance, and current bet. Implement the following methods in Player.java. We have provided you with a Player.java file to fill in.

public class Player{ //declare your fields here //initialize your fields in the constructor public Player(double balance){ } public void deal(Card c){ } //Returns an array of Cards that the Player wishes to discard. //The game engine will call deal() on this player for each card //that exists in the return value. MS2 Instructions: Print the hand to //the terminal using System.out.println and ask the user which cards //they would like to discard. The user will first the number of cards they //wish to discard, followed by the indices, one at a time, of //the card(s) they would like to discard, //Return an array with the appropriate Card objects //that have been discarded, and remove the Card objects from this //player's hand. Use IO.readInt() for all inputs. In cases of error //re-ask the user for input. // // Example call to discard(): // // This is your hand: // 0: Ace of Hearts // 1: 2 of Diamonds // 2: 5 of Hearts // 3: Jack of Spades // 4: Ace of Clubs // How many cards would you like to discard? // 2 // 1 // 2 // // The resultant array will contain the 2 of Diamonds and the 5 of hearts in that order // This player's hand will now only have 3 cards public Card[] discard(){ } //Returns the amount that this player would like to wager, returns //-1.0 to fold hand. Any non zero wager should immediately be deducted //from this player's balance. This player's balance can never be below // 0 at any time. This player's wager must be >= to the parameter min // MS2 Instructions: Show the user the minimum bet via the terminal //(System.out.println), and ask the user for their wager. Use //IO.readDouble() for input. In cases of error re-ask the user for //input. // // Example call to wager() // // How much do you want to wager? // 200 // // This will result in this player's balance reduced by 200 public double wager(double min){ } //Returns this player's hand public Hand showHand(){ } //Returns this player's current balance public double getBalance(){ } //Increase player's balance by the amount specified in the parameter, //then reset player's hand in preparation for next round. Amount will //be 0 if player has lost hand public void winnings(double amount){ } } 

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

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

Have issues been prioritized?

Answered: 1 week ago