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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!