Question: create a java class program 2. Class Garden: a) A Garden object has 1 attributes: garden a 2-D character array representing the garden. Each location


create a java class program
2. Class Garden: a) A Garden object has 1 attributes: garden a 2-D character array representing the garden. Each location will contain one of the following characters: i. f if a flower occupies that location. 't': if a part of a tree occupies that location ii. ii. if that location is empty. A default constructor which creates the array garden as 3x3 array (the default garden size) and initializes each space to '-', the symbol used to represent an empty space using the method initializeGarden() described in d) below. A constructor which takes an integer representing the size of the garden and creates the garden array as a size x size array and initializes each space tothe symbol used to represent an empty space using the method initializeGarden() described in d) below. b) c) d) A private initializeGarden() method which initializes each space in the array garden to e) A getInLocation(int r, int c) method which returns the character stored in location f) AplantFlower (int r, int c) method which stores the character in the location g) A plant Tree(int r, int c) method which stores the character 't' in the locations [rl[c], h) A removeFLower (int r, int c) method which stores the character in the location i) A countPossible Trees() method which returns the number of places a tree can be planted [rl[c] of garden [rl[c] of garden. [r+1]c], [r][c+1] and [r+1][c+1] of garden. [rl[c] of garden. in the garden. A tree takes 4 spots as a 2x2 block. For example if the status of the garden is
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
