Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lab01;
- /**
- * Driver class
- * Runs the full project
- * @author Chad Humphries
- * @version lab01
- * Date Created: Sept 14, 2019
- */
- public class Driver
- {
- /**
- * Default Constructor
- */
- private Driver()
- {
- }
- /**
- * Main method
- * @param args console arguments
- */
- public static void main(String[] args)
- {
- Forest forest = new Forest();
- //Create and plant trees
- forest.plant(new Tree());
- forest.plant(new Tree());
- forest.plant(new Tree("", 5, 1758));
- forest.plant(new Tree("Oak", 6, 2017));
- forest.plant(new Tree("Birch", -3, 2017));
- forest.plant(new Tree("Oak", 6, 1993));
- forest.plant(new Tree("Fir", 13, 2020));
- forest.plant(new Tree(null, 8, 2003));
- forest.plant(new Tree(" ", 1, 1758));
- forest.plant(new Tree());
- //Check all data on trees, attempt a search
- forest.showTrees();
- forest.showTreesByYear(2017);
- System.out.println("Number of trees: " + forest.numberOfTrees());
- //Remove some trees and check again
- forest.removeTreesByYear(2017);
- forest.showTrees();
- System.out.println("Number of trees: " + forest.numberOfTrees());
- //Add a new tree and check once more
- forest.plant(new Tree("Acacia", 3, 1993));
- forest.showTrees();
- forest.showTreesByYear(1993);
- System.out.println("Number of trees: " + forest.numberOfTrees());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement