Question
Write a java program that has two classes: a driven class called MapleTree, and a driver class called MapleTreeDriver. The driver should: Create an object
Write a java program that has two classes: a driven class called MapleTree, and a driver class called MapleTreeDriver.
The driver should:
- Create an object called tree from the MapleTree class.
- Call the plant method to record the planting of the seed.
- Call the germinate method to record the first observation of a seedling and record its height.
- Call the dumpData method to display the current values of all instance variables.
The driven class should contain three private instance variables, plantDate, height, and heightDate. The two dates are to be entered as text in the format, dd/mm/yyyy. This class must include a plant method, a germinate method, and a dumpData method. The plant method prompts the user for and inputs the date of planting. The germinate method prompts the user for and inputs the date on which a seedling is first observed. It also prompts the user for and inputs the height of that seedling above the surface of the soil in meters. (Of course, this will be a fractional value.) The dumpData method prints the current value of all instance variables.
Sample session:
Enter plant date (dd/mm/yyyy): 15/04/2003
Enter germination date (dd/mm/yyyy): 12/06/2003
Enter observed height in meters: 0.007
Plant date = 15/04/2003
Germinate date = 12/06/2003
Initial height = 0.0070 meters
Step by Step Solution
3.44 Rating (147 Votes )
There are 3 Steps involved in it
Step: 1
import javautil class MapleTreeDriver public static void mainString args create an object MapleTree ...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