title: Java hw help: Superclass and attributes
body: <p>I have an assignment where I have to display all the attributes of a class.</p>
  
  <p>My question is what can I do to make the code work without having to add an extra attribute to the person object? </p>
  
  <p>I got the code to work but Apparently I am not supposed to make any changes to the original <em>person</em> class. Which is: </p>
  
  <pre><code>class person
  {
  String firstName;
  String lastName;
  int age;
  
  person(String informedFirstName, String informedLastName, int informedAge)
  {
      firstName = informedFirstName;
      lastName = informedLastName;
      age = informedAge;
  }
  
  String whatIsUp()
  {
   return "undetermined";
  }
  String getName()
  {
      return firstName +" "+lastName;
  }
  String getAge()
  {
      String str = String.valueOf(age);
      return str;
  }
  
  String getInfo()
  {
      return ("Name = "+ getName() + " age="+ getAge());
  }
  }
  </code></pre>
  
  <p>The working code that I have is: </p>
  
  <p>app class</p>
  
  <pre><code>class app
  
  {
    public static void main(String[] args)
   {
  student st1 = new student("Zack","Mills",21,".....");
  professor p1 = new professor("Fred","Fonseca",44,".....");
  TA ta1 = new TA("Paris","Hilton",20,"......");
  System.out.println(st1.getInfo());
  System.out.println(p1.getInfo());
  System.out.println(ta1.getInfo());
   }
  }
  </code></pre>
  
  <p>person class: </p>
  
  <pre><code>class person
  {
  String firstName;
  String lastName;
  int age;
      String status;
  
  person(String informedFirstName, String informedLastName, 
  int informedAge, String informedStatus) //&lt; ---- added attribute informedStatus
  {
      firstName = informedFirstName;
      lastName = informedLastName;
      age = informedAge;
              status = informedStatus;
  }
  
  String whatIsUp()
  {
   return "undetermined";
  }
  String getName()
  {
      return firstName +" "+lastName;
  }
  String getAge()
  {
      String str = String.valueOf(age);
      return str;
  }
      String getStatus(){
          return status;
      }
  
  String getInfo()
  {
      return ("Name = "+ getName() + " age="+ getAge()) + getStatus();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>student class:</p>
  
  <pre><code>class student extends person
  {
  String status;
  student(String informedFirstName, String informedLastName, int informedAge, String informedStatus)
  {
      super(informedFirstName, informedLastName, informedAge, informedStatus);
      if (age &lt;= 25) status = informedStatus = "Traditional";
      else status = informedStatus = "Non-Traditional";
  }
  
  String whatIsUp()
  {
   int n = 0;
   String b = "..."; 
   n = (int) (Math.random()*2);
   if (n == 0) b = "reading";
   if (n == 1) b = "talking";  
   return b;
  }
  String getStatus()
  {
      return " Status = " + status;
  }
  }
  </code></pre>
  
  <p>professor class:</p>
  
  <pre><code>class professor extends person
  {
  String status;
  professor(String informedFirstName, String informedLastName, int informedAge, String informedStatus)
  {
      super(informedFirstName, informedLastName, informedAge, informedStatus);
      status = informedStatus = "Computer Science";
  }
  
  String whatIsUp()
  {
   int n = 0;
   String b = "..."; 
   n = (int) (Math.random()*2);
   if (n == 0) b = "reading";
   if (n == 1) b = "talking";  
   return b;
  }
  String getStatus()
  {
      return " Degree = " + status;
  }
  }
  </code></pre>
  
  <p>TA class:</p>
  
  <pre><code>class TA extends person
  {
  String status;
  TA (String informedFirstName, String informedLastName, int informedAge, String informedStatus)
  {
      super(informedFirstName, informedLastName, informedAge, informedStatus);
      status = informedStatus = "Excellent";
  }
  
  String whatIsUp()
  {
   int n = 0;
   String b = "..."; 
   n = (int) (Math.random()*2);
   if (n == 0) b = "reading";
   if (n == 1) b = "talking";  
   return b;
  }
  String getStatus()
  {
      return " Communication Skills = " + status;
  }
   }
  </code></pre>
  
  <p>Sorry for all the code and any help is greatly appreciated. </p>