Question: Create a java program called notGotRed which simulates 2 players playing the following game: A bag contains 2 red marbles and 9 green marbles. A

Create a java program called notGotRed which simulates 2 players playing the following game: A bag contains 2 red marbles and 9 green marbles. A player blindly picks one marble from the bag and returns the marble to the bag. If the selected marble is green, the player rolls 2 dice and adds the total face value of the dice to their score. If they roll a double (i.e. the face values are the same), the player's total score remains unchanged (i.e. a 0 score for that round). The player then picks a marble from the bag again, rolling again if a green marble is picked, and so on. The player's turn is finished when he picks a red marble. For example: Player 1 picks a green marble, rolls 4 and 3, picks a green marble again and rolls 2 and 2, picks a green marble again and rolls 2 and 5, then picks a red marble. Player 1 scores 14. Player 2 picks a green marble and rolls 6 and 4, then picks a red marble. Player 2 scores 10. Player 1 wins. Sample output 1: Player 1: 14 Player 2: 10 Player 1 wins Sample output 2: Player 1: 7 Player 2: 7 Tie

Instructions -Use integers to represent the colors, considering the amount marbles for each color -Your solution must include a method named displayWinner that accepts the player scores as parameters and does not have a return value. -The winning roll must be determined by using Math or Integer utility method - cannot use arrays or arraylists - cannot use try or catch methods

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!