Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * The Student class represents a student in a student administration system.
- * It holds the student details relevant in our context.
- *
- * @author Michael Kölling and David Barnes
- * @version 2016.02.29
- */
- public class Instructor extends Person
- {
- // the instructor's full name
- private String name;
- // the teacher ID
- private String id;
- // the amount of classes the instructor instructs.
- private int workload;
- /**
- * Create a new student with a given name and ID number.
- */
- public Instructor(String fullName, String teacherID)
- {
- name = fullName;
- id = teacherID;
- workload = 2;
- }
- /**
- * Return the full name of this teacher.
- */
- public String getName()
- {
- return name;
- }
- /**
- * Set a new name for this teacher.
- */
- public void changeName(String replacementName)
- {
- name = replacementName;
- }
- /**
- * Return the teacherID of this student.
- */
- public String getTeacherID()
- {
- return id;
- }
- /**
- * Add some classes to the teachers workload.
- */
- public void addWork(int additionalClasses)
- {
- workload += additionalClasses;
- }
- /**
- * Return the number of classes the teacher has.
- */
- public int getClasses()
- {
- return workload;
- }
- /**
- * Return the login name of this teacher. The login name is a combination
- * of the first four characters of the teacher's name and the first three
- * characters of the teacher's ID number.
- */
- public String getLoginName()
- {
- return name.substring(0,4) + id.substring(0,3);
- }
- /**
- * Print the teacher's name and ID number to the output terminal.
- */
- public void print()
- {
- System.out.println(name + ", teacher ID: " + id + ", Classes: " + workload);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement