Question: JAVA: write a client program to display the following; rnum is between 0 to 10. rnum = 3 if it (random number) is Question 4.0
JAVA:

write a client program to display the following; rnum is between 0 to 10. rnum = 3 if it (random number) is

Question 4.0 (15 points) This question deals with overloading both the constructors and ordinary method calls in OOP. This problem is similar to the above two questions except adding two overloaded ordinary method calls to the problems. This program does not track the number of tree objects created but updating the tree heights for each of the Tree objects. class Tree { int height; Tree () { print("Planting a tree: start seedling"); height = 0; Tree(int initialHeight) { height = initialHeight; print("Creating new Tree that is " + height + " feet tall"); void info() { print("Tree is " + height + " feet tall"); void info (String s) { print(s + ": Tree is " + height + " feet tall"); // replace print (...) with System.out.print (....); Planting a tree: start seedling Tree is 0 feet tall rnum = 1 Creating new Tree that is 1 feet talll Tree is 1 feet tall Keep it growing : Tree is 1 feet tall Creating new Tree that is 2 feet tall Tree is 2 feet tall Keep it growing : Tree is 2 feet tall Creating new Tree that is 3 feet tall Tree is 3 feet tall Keep it growing : Tree is 3 feet tall Or (depending on the random number) Planting a tree: start seedling Tree is 0 feet tall rnum = 5 Creating new Tree that is 1 feet tall Tree is 1 feet tall Keep it growing : Tree is 1 feet tall Creating new Tree that is 2 feet tall Tree is 2 feet tall Keep it growing : Tree is 2 feet tall Creating new Tree that is 3 feet tall Tree is 3 feet tall Keep it growing : Tree is 3 feet tall Creating new Tree that is 4 feet tall Tree is 4 feet tall Keep it growing : Tree is 4 feet tall Creating new Tree that is 5 feet tall Tree is 5 feet tall Keep it growing : Tree is 5 feet tall
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
