Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.0 kB
1
Indexable
Never
import java.util.*;
public class Professor extends Person {
    private String department;
    private double salary;
    private ArrayList<Student>advisees = new ArrayList<Student>();

public Professor(String firstName, String lastName, int id, String department, double salary){
    super(firstName, lastName, id);
    this.department = department; 
    this.salary = salary;
    
}

public String getDepartment(){
    return department;
}

public void setDepartment(String department){
    this.department = department;
}

public double getSalary(){
    return salary;
}

public void setSalary(double salary){
    this.salary = salary;
}

public ArrayList<Student> getAdvisees(){
    return advisees;
}

public void addAdvisee(Student s){
    advisees.add(s);
}


public boolean removeAdvisee(int n){
    for (int i = 0; i < getAdvisees.size(); i++) {
        if (advisees.get(i).getId() == in){
            advisees.remove(i);
            return true;
        }
        return false;
    }
}

}