title: Inheritance Lab
body: <p>I'm working on a lab with couple super classes. When I used my compiled my TestingClass it highlighted the following as a syntax error: </p>
  
  <pre><code>CollegeStudent ima = new CollegeStudent("Ima Frosh", 18, "F", "UCB123",
  </code></pre>
  
  <p>The following is all of my code for this lab: </p>
  
  <p>TESTING CLASS</p>
  
  <pre><code>public class TestingClass
   {
   public static void main(String[] args) 
      {
  Person bob = new Person("Coach Bob", 27, "M");
  System.out.println(bob);
  
  Student lynne = new Student("Lynne Brooke", 16, "F", "HS95129", 3.5);
  System.out.println(lynne);
  
      Teacher mrJava = new Teacher("Duke Java", 34, "M", "Computer Science", 50000);
  System.out.println(mrJava);
  
  CollegeStudent ima = new CollegeStudent("Ima Frosh", 18, "F", "UCB123",
                                           4.0, 1, "English");
  System.out.println(ima);
  
          }
  }
  </code></pre>
  
  <p>PERSON CLASS</p>
  
  <pre><code>    public class Person
  {
    private String myName ;   // name of the person
    private int myAge;        // person's age
    private String myGender;  // "M" for male, "F" for female
  
    // constructor
  
  
    public Person(String name, int age, String gender)
    {
      myName = name;
      myAge = age;
      myGender = gender;
    }
  
    public String getName()
    {
      return myName;
    }
  
  
      public int getAge()
      {
      return myAge;
    }
  
    public String getGender()
    {
      return myGender;
    }
  
    public void setName(String name)
    {
      myName = name;
    }
  
    public void setAge(int age)
    {
      myAge = age;
    }
  
    public void setGender(String gender)
    {
      myGender = gender;
    }
  
    public String toString()
    {
       return myName + ", age: " + myAge + ", gender: " + 
              myGender;
    }
  }
  </code></pre>
  
  <p>TEACHER CLASS</p>
  
  <pre><code>    public class Teacher extends Person
  {
      // instance variables - replace the example below with your own
      private String mySubject;
      private double myAnnualSalary;
  
      /**
       * Constructor for objects of class Teacher
       */
      public Teacher(String name, int age, String gender, String Subject, double AnnualSalary)
      {
          // initialise instance variables
          super(name, age, gender);
          mySubject = Subject;
          myAnnualSalary = AnnualSalary;
      }
  
      /**
       * An example of a method - replace this comment with your own
       * 
       * @param  y   a sample parameter for a method
       * @return     the sum of x and y 
       */
     public String getSubject()
     {
         return mySubject;
     }
  
     public double getAnnualSalary()
     {
         return myAnnualSalary;
     }
  
     public void setSubject(String Subject)
     {
         mySubject = Subject;
     }
  
     public void setAnnualSalary(double AnnualSalary)
     {
         myAnnualSalary = AnnualSalary;
     }
  
     public String toString()
     {
         return super.toString() + "Subject:" + mySubject + "Annual Salary:" + myAnnualSalary;
      }
  }
  </code></pre>
  
  <p>STUDENT CLASS</p>
  
  <pre><code>    public class Student extends Person
      {
          private String myIdNum;    // Student Id Number
          private double myGPA;      // grade point average
  
          // constructor
          public Student(String name, int age, String gender,
                   String idNum, double gpa)
                   {
              // use the super class' constructor
              super(name, age, gender);
  
              // initialize what's new to Student
              myIdNum = idNum;
              myGPA = gpa;
          }
  
          public String getIdNum()
          {
              return myIdNum;
          }
  
          public double getGPA()
          {
              return myGPA;
         }
  
  
  public void setIdNum(String idNum)
  {
      myIdNum = idNum;
  }
  
  public void setGPA(double gpa)
  {
      myGPA = gpa;
  }
  
  // overrides the toString method in the parent class
  public String toString()
  {
  return super.toString() + ", student id: " + myIdNum + ", gpa: " + myGPA;
  }
  }
  </code></pre>
  
  <p>COLLEGE STUDENT CLASS</p>
  
  <pre><code>    public class CollegeStudent extends Student
  {
      // instance variables - replace the example below with your own
      private int myYear;
      private String myMajor;
      /**
       * Constructor for objects of class dasf
       */
      public CollegeStudent(String idNum, double gpa, String name, int age, String gender, int Year, String Major)
      {
          // initialise instance variables
          super(name, age, gender, idNum, gpa);
          myMajor = Major;
          myYear = Year;
      }
  
      /**
       * An example of a method - replace this comment with your own
       * 
       * @param  y   a sample parameter for a method
       * @return     the sum of x and y 
       */
      public String getMajor()
      {
          return myMajor;
      }
  
      public int getYear()
      {
          return myYear;
      }
  
      public void setMajor(String Major)
      {
          myMajor = Major;
      }
  
      public void setYear(int Year)
      {
          myYear = Year;
      }
      public String toString()
      {
          return super.toString() + "Year:" + myYear + "Major:" + myMajor;
      }
  }
  </code></pre>