Commit d0595d7b authored by 9731065's avatar 9731065

Professor complitted

parent 5c0b2af2
Pipeline #599 canceled with stages
......@@ -4,7 +4,8 @@ public abstract class Employee extends Person {
protected ArrayList<Statement> statements = new ArrayList<>();
protected String position;
protected double basicIncome;
public Employee (String position){
public Employee (String firstName , String lastName , String id , int joiningYear , Department department , String position){
super(firstName , lastName , id , joiningYear , department);
this.position = position;
}
......@@ -26,4 +27,5 @@ public abstract class Employee extends Person {
public void addBankStatement (Statement statement){
this.statements.add(statement);
}
public abstract double getCurrentIncome ();
}
......@@ -4,6 +4,13 @@ public abstract class Person {
protected String id;
protected int joiningYear;
protected Department department;
public Person (String firstName , String lastName , String id , int joiningYear , Department department){
this.firstName = firstName;
this.lastName = lastName;
this.id = id;
this.joiningYear = joiningYear;
this.department = department;
}
public String getFullName() {
return firstName + " " + lastName;
......
import java.util.ArrayList;
public class Professor extends Employee {
private ArrayList<Course> courses = new ArrayList<>();
private String group;
public Professor(String firstName , String lastName , String id , int joiningYear , Department department , String position , String group){
super(firstName , lastName , id , joiningYear , department , position);
this.group = group;
}
public ArrayList<Course> getCourses() {
return courses;
}
public String getGroup() {
return group;
}
public void addCourse (Course c){
courses.add(c);
}
@Override
public double getCurrentIncome () {
double sum = 0;
for (int i = 0; i < this.statements.size(); i++) {
sum += this.statements.get(i).getAmount();
}
return this.basicIncome + sum;
}
}
public class ServiceEmployee extends Employee {
@Override
public double getCurrentIncome (){
return this.basicIncome;
}
public ServiceEmployee(String firstName , String lastName , String id , int joiningYear , Department department , String position){
super(firstName , lastName , id ,joiningYear , department , position);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment