Question
Java question Game class: Add a constructor to do the following a. Access level modifier public b. Empty parameter list c. Call method createPlayers d.
Java question
Game class:
Add a constructor to do the following a. Access level modifier public b. Empty parameter list c. Call method createPlayers d. Call method displayPlayers e. Call method playGame 2. Add method createPlayers to do the following a. Access level modifier private b. Return type void c. Empty parameter list d. Instantiate the member variable of class ArrayList representing the collection of class Player e. Instantiate an instance of class Scanner so it takes input from the console f. Prompt the user from the console to enter their name and store the value in an instance of class String g. Instantiate an instance of class HumanPlayer h. Call method setName in class Player for the instance of class HumanPlayer passing as an argument the data read from the console i. Instantiate and instance of class AiPlayer j. Call method setName in class Player for the instance of class AiPlayer passing as an argument a string the AI players name k. Add to the member variable of class ArrayList representing the collection of class Player the instance of class HumanPlayer and AiPlayer instantiated above 3. Add method displayPlayers to do the following a. Access level modifier private b. Return type void c. Empty parameter list d. Loop through the member variable of class ArrayList representing the collection of class Player i. Output to the console each players name by calling method getName in class Player for each instance 4. Add method playGame to do the following a. Access level modifier private b. Return type void c. Empty parameter list d. Loop through the member variable of class ArrayList representing the collection of class Player i. Call method rollDice in class Player passing as an argument the member variable of class Roll ii. Call method displayDice in class Roll
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started