You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

18 lines
511 B

public class Teacher extends Person {
private String subject;
private int yearsOfExperience;
public Teacher(String name, int age, String subject, int yearsOfExperience) {
super(name, age);
this.subject = subject;
this.yearsOfExperience = yearsOfExperience;
}
@Override
public String getRole() { return "Teacher"; }
@Override
public String getExtraInfo() {
return "Subject: " + subject + ", Experience: " + yearsOfExperience + " years";
}
}