/**
 * This is very simplistic Orc class. It has only two data members: name and
 * ugliness.  This is for testing purposes, to be used with TestOrc.java.  
 * CSCE 155 Fall 2005
 * @author Leen-Kiat Soh
 * @version 1.0
 */
import java.*;

class Orc {

   private String name;                   // name of the orc
   private int ugliness;                  // ugliness 1-10 (10 is really ugly)
   private int age;                        // age of the orc
   private final int minAge = 1;	  // minimum age of an orc -- constant
   private final int maxUgliness = 10;
   private final int minUgliness = 0;	  
   public final double PI = 3.1416;

   /**
    * This is the constructor of the class.  It initializes the instance 
    * variables.
    */

   public Orc()  {

      name = "Arrrrggghh";
      age = minAge;
      //ugliness = maxUgliness;
      ugliness = 2;

      }

   public Orc(String givenName)  {

      name = givenName;
      ugliness = maxUgliness;
      age = minAge;

   }


   /**
    * This is another constructor of the class.  This expects two parameters, 
    * a String that gives the name of the object, and an integer that 
    * determines the ugliness of the object.
    * @params givenName the name of the object to be created
    * @params ugly the degree of ugliness of the object to be created
    */

   public Orc(String givenName, int ugly)  {

      name = givenName;
      ugliness = ugly;
      age = minAge;

   }

   public void doSomething()  {

      System.out.println("Do something nothing blah blah blah...");

   }

   /**
    * A very useful method to printout the information of an object.  It takes 
    * a string parameter.
    * @params commander a salutation string
    */

   public void printInfo(String commander)  {

      System.out.println(commander + ": My name is " + name);
      System.out.println(commander + ": My ugliness is " + ugliness);
      System.out.println(commander + ": My age is " + age);

   }

   /**
    * This returns the name of the Orc object.  It returns a String.
    * @return <code>String</code>
    */

   public String getName()  {
      return "Mr. " + name;
      }

   /**
    * This returns the ugliness of the Orc object.  It returns an int.
    * @return <code>int</code>
    */

   public int getUgliness()  {
      return ugliness;
      }

   /**
    * This returns the age of the Orc object.  It returns an int.
    * @return <code>int</code>
    */
   public int getAge ()  {
      return age;
      }

   /**
    * This sets the name of the Orc object.  It requires a String parameter.
    * Note the use of 'this'.  
    * @params name the new name of the object
    */
   public void setName(String givenName) {

      name = givenName;
   }

   /**
    * This sets the name of the Orc object.  It requires an int.  This method 
    * has a "quality control" check -- to make sure that the new ugliness 
    * value is within a minimum (minUgliness) and a maximum (maxUgliness).
    * @params x the ugliness degree of the object.
    */

   public void setUgliness(int x)  {
      if (x >= minUgliness && x <= maxUgliness)
         ugliness = x;
      else
	 ugliness = 5;
   }

   /**
    * This sets the age of the Orc object.  It requires an int.  This method 
    * has a "quality control" check -- to make sure that the minimum age is 
    * set to minAge.
    * @params y the new age of the object.
    */
   public void setAge(int y)  {

      if (y >= minAge)  
         age = y;
      else
	 age = minAge;

      System.out.println("setAge method: age has been changed to " + age);

   }


}  // end Orc class


