Commit 6744c3ef authored by 9731044's avatar 9731044

second commit

parent 54f71a19
...@@ -2,7 +2,7 @@ package org.university.core; ...@@ -2,7 +2,7 @@ package org.university.core;
import java.util.ArrayList; import java.util.ArrayList;
public abstract class AbstractEmployee extends Person{ public abstract class AbstractEmployee extends Person implements AccountingInterface{
ArrayList<Statement> bankStatements; ArrayList<Statement> bankStatements;
String position; String position;
double basicIncome , currentIncome; double basicIncome , currentIncome;
...@@ -13,6 +13,29 @@ public abstract class AbstractEmployee extends Person{ ...@@ -13,6 +13,29 @@ public abstract class AbstractEmployee extends Person{
this.basicIncome = basicIncome; this.basicIncome = basicIncome;
bankStatements = new ArrayList<>(); bankStatements = new ArrayList<>();
} }
public abstract boolean isPromotable();
public abstract double calCurrentIncome();
@Override
public AbstractEmployee callEmployee() {
return this;
}
@Override
public double callCurrentIncome() {
return callCurrentIncome();
}
public void setBasicIncome(double basicIncome) {
this.basicIncome = basicIncome;
}
public double getBasicIncome() {
return basicIncome;
}
public void setPosition(String p) {
this.position = p;
}
public String getPosition() { public String getPosition() {
return position; return position;
...@@ -30,7 +53,6 @@ public abstract class AbstractEmployee extends Person{ ...@@ -30,7 +53,6 @@ public abstract class AbstractEmployee extends Person{
this.currentIncome = currentIncome; this.currentIncome = currentIncome;
} }
public abstract double calCurrentIncome();
......
package org.university.core; package org.university.core;
import java.util.ArrayList;
public class Account { public class Account {
private AbstractEmployee owner; private AbstractEmployee owner;
double credit; private double credit;
public boolean flag = true;
public Account(AbstractEmployee owner , double credit) { public Account(AbstractEmployee owner , double credit) {
this.credit = credit; this.credit = credit;
...@@ -11,6 +15,14 @@ public class Account { ...@@ -11,6 +15,14 @@ public class Account {
this.credit=0; this.credit=0;
} }
private void checkout(AbstractEmployee e) {
credit+= e.calCurrentIncome();
setCredit(credit);
flag =false;
}
public AbstractEmployee getOwner() { public AbstractEmployee getOwner() {
return owner; return owner;
} }
...@@ -26,4 +38,6 @@ public class Account { ...@@ -26,4 +38,6 @@ public class Account {
} }
package org.university.core;
public interface AccountingInterface {
public AbstractEmployee callEmployee();
public double callCurrentIncome();
}
package org.university.core; package org.university.core;
import java.util.ArrayList;
public class AccountingManagement { public class AccountingManagement {
private ArrayList<Account> accounts;
private ArrayList<Statement> statements;
public void settle(AccountingInterface employee)
{
for (Account account:accounts)
{
if (account.getOwner()==employee)
{
double amount = employee.callCurrentIncome();
account.setCredit(account.getCredit()+amount);
Statement s = new Statement(employee.callEmployee(), amount);
statements.add(s);
}
}
}
public ArrayList<Statement> getStatements(){
return statements;
}
} }
...@@ -2,4 +2,20 @@ package org.university.core; ...@@ -2,4 +2,20 @@ package org.university.core;
public class Article { public class Article {
String name;
String datePublished;
public Article(String name,String datePublished) {
this.name = name;
this.datePublished = datePublished;
}
public String getName() {
return name;
}
public String getDate() {
return datePublished;
}
} }
package org.university.core; package org.university.core;
public class GraduateStudent { import java.util.ArrayList;
public class GraduateStudent extends Student {
ArrayList<Article> articles;
Professor advisor;
public GraduateStudent(String firstName, String lastName, String ID, int joiningYear, Department department,Professor advisor) {
super(firstName, lastName, ID, joiningYear, department);
articles = new ArrayList<>();
this.advisor = advisor;
}
public void addArticle(Article a) {
articles.add(a);
}
public ArrayList<Article> getArticle(){
return articles;
}
public Professor getAdvisor() {
return advisor;
}
} }
...@@ -31,5 +31,14 @@ public class Person { ...@@ -31,5 +31,14 @@ public class Person {
return department; return department;
} }
public void setDepartment(Department d) {
this.department = d;
}
// public AbstractEmployee callEmployee() {
// return null;
// }
} }
...@@ -15,18 +15,10 @@ public class Professor extends AbstractEmployee { ...@@ -15,18 +15,10 @@ public class Professor extends AbstractEmployee {
articles = new ArrayList<>(); articles = new ArrayList<>();
} }
public void setPosition(String position) {
this.position = position;
}
public void setGroup(String group) { public void setGroup(String group) {
this.group=group; this.group=group;
} }
public void setBasicIncome(double basicIncome) {
this.basicIncome = basicIncome;
}
public void addCourse(Course c) { public void addCourse(Course c) {
courses.add(c); courses.add(c);
} }
...@@ -50,5 +42,10 @@ public class Professor extends AbstractEmployee { ...@@ -50,5 +42,10 @@ public class Professor extends AbstractEmployee {
} }
@Override
public boolean isPromotable() {
return false;
}
} }
...@@ -14,6 +14,11 @@ public class ServiceEmployee extends AbstractEmployee { ...@@ -14,6 +14,11 @@ public class ServiceEmployee extends AbstractEmployee {
} }
@Override
public boolean isPromotable() {
return false;
}
......
package org.university.core; package org.university.core;
public class Statement { public class Statement {
AbstractEmployee employee;
double paymentFee;
String paymentNo;
String paymentDate;
public Statement(AbstractEmployee employee, double paymentFee) {
this.employee = employee;
this.paymentFee = paymentFee;
}
public void setEmployee(AbstractEmployee emp) {
this.employee = emp;
}
public AbstractEmployee getEmployee() {
return employee;
}
public void setFee(double amount) {
this.paymentFee = amount;
}
public double getFee() {
return paymentFee;
}
} }
...@@ -6,4 +6,6 @@ public class Undergrad extends Student { ...@@ -6,4 +6,6 @@ public class Undergrad extends Student {
super(firstName, lastName, ID, joiningYear, department); super(firstName, lastName, ID, joiningYear, department);
} }
} }
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