Κλάση Tree

import gr.aueb.dds.BIO;

class Tree {
        // Tree properties
        private int treeWidth;          // Width of the tree
        private int trunkWidth;         // Width of the trunk
        private int trunkHeight;        // Height of the trunk
        private char treeFill;          // Fill character

        // Constructor
        // ew : Tree body width
        // uw : Trunk width
        // uh : Trunk heigth
        // f : fill character
        Tree(int ew, int uw, int uh, char f) {
                treeWidth = ew;
                trunkWidth = uw;
                trunkHeight = uh;
                treeFill = f;
        }

        // Draw a tree
        public void draw() {
                body();
                trunk();
        }

        // Draw the tree's body
        private void body() {
                int i;

                for (i = 1; i < treeWidth; i = i + 2) {
                        DrawChar.space((treeWidth - i) / 2);
                        fill(i);
                        BIO.println();
                }
        }

        // Draw the tree's trunk
        private void trunk() {
                int j;

                for (j = 0; j < trunkHeight; j = j + 1) {
                        DrawChar.space((treeWidth - trunkWidth) / 2);
                        fill(trunkWidth);
                        BIO.println();
                }
        }

        // Display n space characters
        static private void space(int n) {
                DrawChar.repeatChar(n, ' ');
        }

        // Display n treeFill characters
        private void fill(int n) {
                DrawChar.repeatChar(n, treeFill);
        }

        public static void main(String args[]) {
                Tree t = new Tree(822'!');
                Tree bigt = new Tree(1334'#');

                DrawChar.repeatChar(79'*');
                BIO.println();
                t.draw();
                bigt.draw();
                t.draw();
        }
}