Answer to Question #279817 in Java | JSP | JSF for Hab1bti

Question #279817

Create a constructor. It should take in three arguments (in this order): an array of



Player


s, a



Die


, and an



int



representing the victory score.



The constructor should store all of these in



private fields.



4.



Create a method called



play()


. It takes no arguments.



(a)



Do the following



forever



(yes, really.



We’ll use a



return



statement to end the method



when the game is over).



i.



Loop



over



the



array



of



players.



For



each



player,



do



the



following:



(you



probably



want to do a



for



loop over the array of players)



1
Expert's answer
2021-12-15T11:37:53-0500
public class Game {
    private Player[] players;
    private Die die;
    private int victoryScore;

    public Game(Player[] players, Die die, int victoryScore) {
        this.players = players;
        this.die = die;
        this.victoryScore = victoryScore;
    }

    public void play() {
        while (true) {
            for (Player player : players) {

            }
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog