Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. /**
  2. * The Student class represents a student in a student administration system.
  3. * It holds the student details relevant in our context.
  4. *
  5. * @author Michael Kölling and David Barnes
  6. * @version 2016.02.29
  7. */
  8. public class Instructor extends Person
  9. {
  10. // the instructor's full name
  11. private String name;
  12. // the teacher ID
  13. private String id;
  14. // the amount of classes the instructor instructs.
  15. private int workload;
  16.  
  17. /**
  18. * Create a new student with a given name and ID number.
  19. */
  20. public Instructor(String fullName, String teacherID)
  21. {
  22. name = fullName;
  23. id = teacherID;
  24. workload = 2;
  25. }
  26.  
  27. /**
  28. * Return the full name of this teacher.
  29. */
  30. public String getName()
  31. {
  32. return name;
  33. }
  34.  
  35. /**
  36. * Set a new name for this teacher.
  37. */
  38. public void changeName(String replacementName)
  39. {
  40. name = replacementName;
  41. }
  42.  
  43. /**
  44. * Return the teacherID of this student.
  45. */
  46. public String getTeacherID()
  47. {
  48. return id;
  49. }
  50.  
  51. /**
  52. * Add some classes to the teachers workload.
  53. */
  54. public void addWork(int additionalClasses)
  55. {
  56. workload += additionalClasses;
  57. }
  58.  
  59. /**
  60. * Return the number of classes the teacher has.
  61. */
  62. public int getClasses()
  63. {
  64. return workload;
  65. }
  66.  
  67. /**
  68. * Return the login name of this teacher. The login name is a combination
  69. * of the first four characters of the teacher's name and the first three
  70. * characters of the teacher's ID number.
  71. */
  72. public String getLoginName()
  73. {
  74. return name.substring(0,4) + id.substring(0,3);
  75. }
  76.  
  77. /**
  78. * Print the teacher's name and ID number to the output terminal.
  79. */
  80. public void print()
  81. {
  82. System.out.println(name + ", teacher ID: " + id + ", Classes: " + workload);
  83. }
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement