/**
 * Models a bird.
 * 
 * Demonstrates methods, constructors, and encapsulation.
 *
 * @author Zach Tomaszewski
 * @version 22 Oct 2008
 */
public class Bird {

  //constants to be used when setting a bird's size
  public static final int TINY = 1;
  public static final int SMALL = 2;
  public static final int MEDIUM = 3;
  public static final int LARGE = 4;

  //instance variables: every instance gets its own copy of these
  public int size;
  public boolean canFly;
  public String type;


  //CONSTRUCTORS

  /**
   * Default constructor, equivalent to what Java inserts for you
   * if you do not write a constructor of you own.
   */
  public Bird() {
  }

  /**
   * Constructs a new Bird of the given size, flight capability, and
   * type.  Limits size to allowed values:  if too small, the Bird
   * will be made TINY; if too large, will be made LARGE.
   */
  public Bird(int size, boolean canFly, String type) {
    if (size > Bird.LARGE) {
      this.size = Bird.LARGE;
    }else if (size < Bird.TINY) {
      this.size = Bird.TINY;
    } else {
      this.size = size;
    }
    this.canFly = canFly;
    this.type = type;
  }

  /**
   * Constructs a flying bird of the given size and type.
   */
  public Bird(int size, String type) {
    //actually going to let other constructor do the work
    this(size, true, type);
  }


  //METHODS
  
  /**
   * Prints this Bird to the screen as a single line of text.
   */
  public void print() {
    System.out.print("This " + this.type + " is of ");
    switch (this.size){
      case TINY: System.out.print("tiny"); break;
      case SMALL: System.out.print("small"); break;
      case MEDIUM: System.out.print("medium"); break;
      case LARGE: System.out.print("large"); break;
      default: System.out.print("mutated"); break;
    }
    System.out.print(" size and it can");
    if (!this.canFly) {
      System.out.print("not");
    }
    System.out.println(" fly.");
    return;
  }  


}

