title: How to change a person's role in this code
body: <pre><code>public class Person implements Roles{
  
      private String id;
      private String name;
      private String[] skills;
      private List&lt;Note&gt; notes;
  
      public Person(String id, String name, String[] skills) {
          this.id = id;
          this.name = name;
          this.skills = skills;
          this.notes = new ArrayList&lt;Note&gt;();
      }
  
      public String getName() {
          return this.name;
      }
  
      public String getId() {
          return this.id;
      }
  
      public String[] getSkills() {
          return this.skills;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public void setSkills(String[] skills) {
          this.skills = skills;
      }
  
      public void addNote(String note, String authorName) {
          notes.add(new Note(authorName, note));
      }
  
      public String listNotes() {
          String result = this.name + &quot; - &quot; + this.id;
          for (Note note: notes) {
              result += &quot;\n&quot; + note.toString();
          }
          return result;
      }
  
      @Override
      public String toString() {
          String result = this.name + &quot; - &quot; + this.id;
          Arrays.sort(skills);
          for (String skill: skills) {
              result += &quot;\n- &quot; + skills;
          }
          return result;
      }
  
      @Override
      public boolean equals(Object o) {
          if (o == null) {
              return false;
          }
          if (o.getClass() != this.getClass()) {
              return false;
          }
          Person Person2 = (Person) o;
          return this.id.equals(Person2.getId());
      }
  
      @Override
      public int hashCode() {
          return this.id.hashCode();
      }
  }
  </code></pre>
  <pre><code>public class Student extends Person implements Roles {
      
      private String registration;
      private int year;
  
      public Student(String id, String name, String registration, int year, String[] skills) {
          super(id, name, skills);
          this.registration = registration;
          this.year = year;
      }
      
      @Override
      public String toString() {
          String result = super.name + &quot; - &quot; + super.id + &quot;\nStudent - &quot; + this.registration + &quot; - &quot; + this.year;
          Arrays.sort(skills);
          for (String skill: skills) {
              result += &quot;\n- &quot; + skill;
          }
          return result;
      }
      
      @Override
      public String listNotes() {
          String result = super.name + &quot; - &quot; + super.id + &quot;\nStudent - &quot; + this.registration + &quot; - &quot; + this.year + &quot;\nNotes:&quot;;
          for (Note note: notes) {
              result += &quot;\n&quot; + note.toString();
          }
          return result;
      }
  }
  </code></pre>
  <pre><code>public class Teacher extends Person implements Roles{
      
      private String number;
      private String[] subjects;
  
      public Teacher(String id, String name, String number, String[] subjects, String[] skills) {
          super(id, name, skills);
          this.number = number;
          this.subjects = subjects;
      }
      
      @Override
      public String toString() {
          String result = this.name + &quot; - &quot; + this.id + &quot;\nTeacher - &quot; + this.number + &quot; - &quot;;
          
          for (int i = 0; i &lt;= subjects.length - 1; i++) {
              if (i == subjects.length - 1) {
                  result += subjects[i];
                  break;
              }
              
              result += subjects[i] + &quot;, &quot;;
          }
          Arrays.sort(skills);
          for (String skill: skills) {
              result += &quot;\n- &quot; + skill;
          }
          return result;
      }
      
      @Override
      public String listNotes() {
          String result = this.name + &quot; - &quot; + this.id + &quot;\nTeacher - &quot; + this.number + &quot; - &quot;;
          
          for (int i = 0; i &lt;= subjects.length - 1; i++) {
              if (i == subjects.length - 1) {
                  result += subjects[i] + &quot;\n:&quot;;
                  break;
              }
              
              result += subjects[i] + &quot;, &quot;;
          }
          
          for (Note note: notes) {
              result += &quot;\n&quot; + note.toString();
          }
          return result;
      }
  }
  </code></pre>
  <p>The system must be able to register people, students and teachers. I created a superclass Person with Student and Teacher subclasses, and an interface to store in a people map.</p>
  <p>And now I need a way to change the roles of those already registered people, like a person becoming a teacher, or a student being out of a role.</p>