APCS AB Review Project Inheritance, interfaces, abstract classes, polymorphism Tree Project

advertisement
APCS AB Review Project
Inheritance, interfaces, abstract classes, polymorphism Tree Project
Your project should include the following:







A Tree interface with methods getType and doesitloseleaves
Two classes Deciduous and Evergreen that implement the tree interface
Evergreen should have an overloaded constructor, one with a height parameter, and a getHeight method
Two classes Maple and Pine that inherit the Deciduous and Evergreen classes respectively
Both the Maple class and the Pine class should have the properties of Deciduous and Evergreen, except that
each one contains an additional method getName.
A Forest class that will contain an array of Trees
A Botanist class that will hold your main method
The output of the program should be as follows:
A pine tree does not lose its leaves
A maple tree loses its leaves
Create an object that belongs to Pine and
Maple, and use both the getName and
doesitloseleaves methods.
An evergreen tree does not lose its leaves and can grow up
to 367 feet tall.
Create a second Evergreen object and send
an additional height parameter and use the
getType, doesitloseleaves, and getHeight
methods.
An evergreen tree does not lose its leaves
A deciduous tree loses its leaves
This will get printed using the Forest class
and your array
Download