Question: JAVA PROGRAMMING. You must have 4 classes, one of which is the driver class. You must have and use the methods given in the specifications

JAVA PROGRAMMING. You must have 4 classes, one of which is the driver class. You must have and use the methods given in the specifications of the classes. You can add other methods to the classes. It is not advisable to declare a Scanner object in more than one method. I recommend you create one in the driver class and pass it to any method that requires it.

Nancy's Garden Game

For this assignment, you will program Crazy Nancys garden Game. The winner of the game is the player (called gardener from now on) who fills up his/her garden with flowers and trees the first. There are no ties in this game. This game requires luck with the dice and a bit of strategy.

JAVA PROGRAMMING. You must have 4 classes, one of which is the

driver class. You must have and use the methods given in the

specifications of the classes. You can add other methods to the classes.

It is not advisable to declare a Scanner object in more thanone method. I recommend you create one in the driver class and

Rules of the game: 1. 2. 3. Number of players: 2 to 10 Garden size: N x N, where N is at least 3 Each player has a garden board which is empty when they start the game. A player can plant either a flower which takes up one square or a tree which takes up 4 squares (2 x 2) 4. The game works as follows: st a) Determine who goes 11: each player rolls 2 dice. The player with the highest roll goes first, How ever if any player rolls the same total, this process starts over again. Here is a sample output to illustrate the above explanation: Let's see who goes first a rolled a 7 b rolled a 12 c rolled a 7 We will start over as 7 was rolled by a as well. a rolled a 8 b rolled a 9 c rolled a 7 d rolled a 8 We will start over as 8 was rolled by a as well. a rolled a 10 b rolled a 12 c rolled a 7 d rolled a 4 b goes first. Figure 1- Who goes first b) Each player has a turn until there is a winner. During his/her turn a player: Rolls the 2 dice Based on the outcome gets to plant a pre-set number of trees and/or flowers a. b. Total of Roll Action Plant a tree (2x2) and a flower (1x1) Plant 2 flowers (2 times 1x1) Plant 2 trees (2 times 2x2) The rabbit that lives in your garden will eat something that you have planted - might be a flower or part of a tree(1x1) This is determined randomly 12 5 or 10 Any other EVEN number Plant a tree (2x2) (2, 4, or 8) Any other 0DD number Plant a flower (1x1) 7, 9, or 11 Figure 2- Action for each roll of 2 dice It is possible that a player does not have enough room left in his/her garden to plant a tree in which case the player lnoses a turn. It is also possible that a player fills his/her garden before finishing his/her turn when they have 2 items to plant. If this happens then they are declared the winner c. Rules of the game: 1. 2. 3. Number of players: 2 to 10 Garden size: N x N, where N is at least 3 Each player has a garden board which is empty when they start the game. A player can plant either a flower which takes up one square or a tree which takes up 4 squares (2 x 2) 4. The game works as follows: st a) Determine who goes 11: each player rolls 2 dice. The player with the highest roll goes first, How ever if any player rolls the same total, this process starts over again. Here is a sample output to illustrate the above explanation: Let's see who goes first a rolled a 7 b rolled a 12 c rolled a 7 We will start over as 7 was rolled by a as well. a rolled a 8 b rolled a 9 c rolled a 7 d rolled a 8 We will start over as 8 was rolled by a as well. a rolled a 10 b rolled a 12 c rolled a 7 d rolled a 4 b goes first. Figure 1- Who goes first b) Each player has a turn until there is a winner. During his/her turn a player: Rolls the 2 dice Based on the outcome gets to plant a pre-set number of trees and/or flowers a. b. Total of Roll Action Plant a tree (2x2) and a flower (1x1) Plant 2 flowers (2 times 1x1) Plant 2 trees (2 times 2x2) The rabbit that lives in your garden will eat something that you have planted - might be a flower or part of a tree(1x1) This is determined randomly 12 5 or 10 Any other EVEN number Plant a tree (2x2) (2, 4, or 8) Any other 0DD number Plant a flower (1x1) 7, 9, or 11 Figure 2- Action for each roll of 2 dice It is possible that a player does not have enough room left in his/her garden to plant a tree in which case the player lnoses a turn. It is also possible that a player fills his/her garden before finishing his/her turn when they have 2 items to plant. If this happens then they are declared the winner c

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!