In the game of Penny Pitch, a two-dimensional board of numbers islaid out as fol
ID: 3608401 • Letter: I
Question
In the game of Penny Pitch, a two-dimensional board of numbers islaid out as follows:1 1 1 1 1
1 2 2 2 1
1 2 3 2 1
1 2 2 2 1
1 1 1 1 1
A player tosses several pennies on the board, aiming for the numberwith the highest value. At the end of the game, the sum total ofthe tosses is returned. Develop a program that plays this game. Theprogram should perform the following steps each time the userselects the Toss button:
- Generate two random numbers for the row and column of thetoss.
- Add the number at this position to a running total.
- Display the board, replacing the numbers with Ps where thepennies land.
(Hint: You should use a two-dimensionalarray of Square objects for this problem. Eachsquare
contains a number like thoseshown and a Boolean flag that indicates whether or not a pennyhas
landed on that square.
Explanation / Answer
In the game of Penny Pitch, a two-dimensional board of numbers islaid out as fol
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.