Question: Write Java class for a Tree class. This class must have methods to set and get the type (coniferous, deciduous, dead) set and get the

Write Java class for a Tree class. This class must have methods to set and get the type (coniferous, deciduous, dead) set and get the variety (for example apple, maple, etc.) set and get the age set and get the height set and get the value toString method that returns all of the tree information as a string Remember you must guard against wrong values for type, age, and height. Special Note: If you use an if statement to error check the type a string, you must use the equals string method not == or !=. Your tester program may appear to work using == or !=. However, the error checking will fail to work correctly when users input values for the type in a client program. Example to test for a type not equal to dead use !type.equals("dead") do not use type != "dead" Compile the Tree class. Note: You will not be able to execute the Tree class because it does not have a main method. Create a testing program to test the all methods of the Tree class. Save the testing program in the same directory as the Tree class. Compile, execute, and test the testing program to be certain the Tree class is correct. Turn in Tree class testing program

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!