Answered step by step
Verified Expert Solution
Question
1 Approved Answer
create a java class program 3. Class PLaver: 1. A Player object has two attributes: a String name that stores a gardener's name, and a
create a java class program
3. Class PLaver: 1. A Player object has two attributes: a String name that stores a gardener's name, and a Garden object garden which is this player's board game. 2. A constructor which takes two parameters, a String for the player's 3. 4. name and an integer for the size of the garden. An Accessor/get method for the name attribute The following methods are all methods that will have the garden attribute call the corresponding method from the Garden class. This is necessary since garden is a private attribute of the class Player. countPossibleFLowers() by the attribute garden countPossibleTrees () by the attribute garden i. howManyFLowersPossible() which will return the result of a call to the method ii. howMany TreesPossible() which will return the result of a call to the method iii. whatIsPlanted(int r, int c) which will return the result of a call to the iv. plantTreeInGarden(int r, int c) which will call the method plantTree() to v. plantFLowerInGarden(int r, int c) which will call the method plantFlower method getInLocation(r, c) by the attribute garden. plant a flower in garden in location [r][c] to plant a tree in garden in location[r][c], [r+1][c], [r]lc+1] and [r+1][c+1] flower in garden in location [rlIc], which means assigning a "-'to the location vi. eatHere(int r, int c) which will call the method removeFLower)to removeaStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started