Commit 6744c3ef authored by 9731044's avatar 9731044

second commit

parent 54f71a19
......@@ -2,7 +2,7 @@ package org.university.core;
import java.util.ArrayList;
public abstract class AbstractEmployee extends Person{
public abstract class AbstractEmployee extends Person implements AccountingInterface{
ArrayList<Statement> bankStatements;
String position;
double basicIncome , currentIncome;
......@@ -13,6 +13,29 @@ public abstract class AbstractEmployee extends Person{
this.basicIncome = basicIncome;
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() {
return position;
......@@ -30,8 +53,7 @@ public abstract class AbstractEmployee extends Person{
this.currentIncome = currentIncome;
}
public abstract double calCurrentIncome();
}
package org.university.core;
import java.util.ArrayList;
public class Account {
private AbstractEmployee owner;
double credit;
private double credit;
public boolean flag = true;
public Account(AbstractEmployee owner , double credit) {
this.credit = credit;
......@@ -11,6 +15,14 @@ public class Account {
this.credit=0;
}
private void checkout(AbstractEmployee e) {
credit+= e.calCurrentIncome();
setCredit(credit);
flag =false;
}
public AbstractEmployee getOwner() {
return owner;
}
......@@ -23,6 +35,8 @@ public class Account {
this.credit = credit;
}
......
package org.university.core;
public interface AccountingInterface {
public AbstractEmployee callEmployee();
public double callCurrentIncome();
}
package org.university.core;
import java.util.ArrayList;
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;
}
}
package org.university.core;
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;
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 {
return department;
}
public void setDepartment(Department d) {
this.department = d;
}
// public AbstractEmployee callEmployee() {
// return null;
// }
}
......@@ -15,18 +15,10 @@ public class Professor extends AbstractEmployee {
articles = new ArrayList<>();
}
public void setPosition(String position) {
this.position = position;
}
public void setGroup(String group) {
this.group=group;
}
public void setBasicIncome(double basicIncome) {
this.basicIncome = basicIncome;
}
public void addCourse(Course c) {
courses.add(c);
}
......@@ -50,5 +42,10 @@ public class Professor extends AbstractEmployee {
}
@Override
public boolean isPromotable() {
return false;
}
}
......@@ -13,6 +13,11 @@ public class ServiceEmployee extends AbstractEmployee {
return currentIncome;
}
@Override
public boolean isPromotable() {
return false;
}
......
package org.university.core;
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;
}
}
......@@ -5,5 +5,7 @@ public class Undergrad extends Student {
public Undergrad(String firstName, String lastName, String ID, int joiningYear, Department 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