/**
 * A short program that demonstrates how to call the methods in
 * the MethodExamples class.
 *
 * @author Zach Tomaszewski
 */
public class MyClass {

  public static void main(String[] args) {
    //construct a MethodExamples instance so I can all instance methods on it
    MethodExamples ex = new MethodExamples();

    ex.sayHi();

    ex.say("Hello, there...");
    String name = "furry animal.";
    ex.say(name);

    int old = ex.computeAge(1984);
    System.out.println("You are " + old + " years old.");
  }

}//end MyClass


/**
 * Some sample instance methods, which demonstrate how parameters
 * an return values work.
 *
 * @author Zach Tomaszewski
 */
class MethodExamples {

  public void sayHi() {
    System.out.println("Hello!");
  }

  public void say(String mesg) {
    System.out.println(mesg);
  }

  public int computeAge(int yearOfBirth) {
    int currentYear = 2011;
    int age = currentYear - yearOfBirth;
    return age;
  }
}
