question archive A player tosses five pennies on the board, aiming for the number with the highest value

A player tosses five pennies on the board, aiming for the number with the highest value

Subject:Computer SciencePrice: Bought3

A player tosses five pennies on the board, aiming for the number with the highest value. At the end of the game, the sum total of the tosses is returned. Develop a program that plays this game.

The program should display the board and then perform the following steps each time the user presses Enter:

 

? Generate two random numbers for the row and column of the toss.

? Add the number at this position to a running total.

? Display the board, replacing the numbers with Ps where the pennies land.

 

(Hint: You should use a two-dimensional array of Square objects for this problem. Each square contains a number like those shown and a Boolean flag that indicates whether or not a penny has landed on that square.)

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE