Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package gc;
- /**
- * A tree is what grows in a forest. This is a superclass, making it possible to
- * have several types of trees under this.
- * @author hypesystem
- */
- public class Tree {
- protected int age;
- protected double height;
- /**
- * Makes the tree grow one year.
- */
- public void growOneYear() {
- age++;
- }
- public void growOneYear(double shadow) {
- growOneYear();
- }
- /**
- * Gets the height of the tree
- * @return height of tree
- */
- public double getHeight() {
- return height;
- }
- /**
- * Shows the information of the tree (age and height).
- */
- public void show() {
- System.out.print("Alder "+age+" | Højde "+getHeight()+"\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment