Question: Write a program intended to track an arboretum: Tree: Contains three instance variables for ID number, age, and species name Implements a parameterized constructor that
Write a program intended to track an arboretum:
Tree:
Contains three instance variables for ID number, age, and species name
Implements a parameterized constructor that will create a Tree object, and sets the
aforementioned variables
Grove:
Contains two instance variables for an Array of Tree's size and a grove name. You may use
an ArrayList of Tree's if you wish
Implements a parameterized constructor that takes and sets a single parameter for the name
of the grove
Implements a method that will plant a Tree object in the first available spot. The method
should take a Tree object as a parameter, and return an int identifying the spot where the tree
is planted. If no spots are open, return
Implements a method that will remove a Tree object from a given spot. The method should
take an int as a parameter, and remove and return the Tree object at that location in the array.
Implement a ToString method that will print a single int representing the number of Tree's in
the array
GroveTester:
Implement a main function that will carry out the following instructions:
Instantiate a grove object named Grove
Print the grove object named Grove
Instantiate seven Tree objects of species Spruce and age and add them to Grove One
Print the grove object named Grove
Remove the Tree's from Grove One at index and
Print the grove object named Grove
Instantiate one Tree object of species Maple and age and add it to Grove One
Print the grove object named Grove
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
