Commit d5277887 authored by 9731087's avatar 9731087

last commit

parent 85ac1c8e
......@@ -2,27 +2,51 @@ package org.university.core;
import java.util.ArrayList;
public abstract class AbstarctEmployee extends Person {
public abstract class AbstarctEmployee extends Person implements AccountingInterface {
protected ArrayList<Payroll> payrolls;
protected ArrayList<Payroll> payrolls = new ArrayList<Payroll>();
protected int defPay;
protected int income;
protected String state;
public AbstarctEmployee(String firstName, String lastName, String ID, int joiningYear, Department department, int defPay, ArrayList<Payroll> payrolls) {
public AbstarctEmployee(String firstName, String lastName, String ID, int joiningYear, Department department, int defPay, ArrayList<Payroll> payrolls, String state) {
super(firstName, lastName, ID, joiningYear, department);
this.defPay = defPay;
this.payrolls = payrolls;
this.state = state;
this.income = 0;
}
public ArrayList<Payroll> getPayrolls() {
return this.payrolls;
}
public void addPayroll(Payroll payroll) {
this.payrolls.add(payroll);
}
public int getDefPay() {
return defPay;
}
abstract public int incomeCalculate();
public abstract int incomeCalculate();
public abstract boolean isPromoteable();
public int getIncome() {
return income;
}
public void setIncome(int income) {
this.income = income;
}
public void setDefPay(int defPay) {
this.defPay = defPay;
}
public String getState() {
return state;
}
abstract public boolean isPromoteable ();
}
package org.university.core;
public interface AccountingInterface {
public int calCurrentIncome();
public AbstarctEmployee callEmployee();
}
package org.university.core;
import org.university.core.Course;
import org.university.core.Department;
import org.university.core.Student;
import java.util.ArrayList;
public class Bachler extends Student {
public Bachler(String firstName, String lastName, String ID, int joiningYear, Department department, ArrayList<Course> courses) {
private Type field;
public Bachler(String firstName, String lastName, String ID, int joiningYear, Department department, ArrayList<Course> courses, Type field) {
super(firstName, lastName, ID, joiningYear, department, courses);
this.field = field;
}
public void setField(Type field) {
this.field = field;
}
public Type getField() {
return field;
}
}
......@@ -5,6 +5,11 @@ public class Essay {
private String title;
private int modYear;
public Essay(String title, int modYear){
this.title = title;
this.modYear = modYear;
}
public String getTitle() {
return title;
}
......
package org.university.core;
public class FinancialAccount {
private AbstarctEmployee owner;
private int stock;
private int creditor;
public FinancialAccount(AbstarctEmployee owner, int amount) {
this.owner = owner;
this.stock = amount;
this.creditor = 0;
}
public AbstarctEmployee getOwner() {
return owner;
}
public int getCreditor() {
return creditor;
}
public void setCreditor(int creditor) {
this.creditor += creditor;
}
public void setStock(int stock) {
this.stock += stock;
}
public void checkOut(int amount) {
this.stock += amount;
this.creditor = 0;
}
}
package org.university.core;
import java.util.ArrayList;
public class FinancialSystem {
private int stock;
private ArrayList<FinancialAccount> financialAccounts;
private ArrayList<Payroll> payrolls;
public void addAccount(FinancialAccount account) {
this.financialAccounts.add(account);
}
public void checkOut(FinancialAccount account) {
this.stock -= account.getCreditor();
account.checkOut(account.getCreditor());
}
public void settle(AccountingInterface employee) {
for (FinancialAccount fc : financialAccounts
) {
if (fc.getOwner() == employee) {
if (fc.getCreditor() > 0) {
this.stock -= fc.getCreditor();
fc.checkOut(fc.getCreditor());
}
}
}
}
}
......@@ -3,6 +3,6 @@ package org.university.core;
public class Main {
public static void main(String[] args) {
System.out.println("Hello World!");
System.out.println("This is not the real main!");
}
}
......@@ -5,13 +5,23 @@ import java.util.ArrayList;
public class Master extends Student {
private ArrayList<Essay> essays;
private Teacher teacher;
public Master(String firstName, String lastName, String ID, int joiningYear, Department department, ArrayList<Course> courses, ArrayList<Essay> essays) {
public Master(String firstName, String lastName, String ID, int joiningYear, Department department, ArrayList<Course> courses, ArrayList<Essay> essays, Teacher teacher) {
super(firstName, lastName, ID, joiningYear, department, courses);
this.essays = essays;
this.teacher = teacher;
}
public ArrayList<Essay> getEssays() {
return essays;
}
public void addEssay(Essay essay) {
this.essays.add(essay);
}
public Teacher getTeacher() {
return teacher;
}
}
......@@ -5,7 +5,14 @@ public class Payroll {
private int id;
private int income;
private int date;
private Person owner;
private AbstarctEmployee owner;
public Payroll(int id, int income, int date, AbstarctEmployee owner) {
this.id = id;
this.income = income;
this.date = date;
this.owner = owner;
}
public int getIncome() {
return income;
......@@ -19,7 +26,7 @@ public class Payroll {
return date;
}
public Person getOwner() {
public AbstarctEmployee getOwner() {
return owner;
}
}
......@@ -4,17 +4,41 @@ import java.util.ArrayList;
public class ServiceEmployee extends AbstarctEmployee {
public ServiceEmployee(String firstName, String lastName, String ID, int joiningYear, Department department, int defPay, ArrayList<Payroll> payrolls) {
super(firstName, lastName, ID, joiningYear, department, defPay, payrolls);
int overTime;
int passedDays;
public ServiceEmployee(String firstName, String lastName, String ID, int joiningYear, Department department, int defPay, ArrayList<Payroll> payrolls, String state) {
super(firstName, lastName, ID, joiningYear, department, defPay, payrolls, state);
this.overTime = 0;
this.passedDays = 0;
}
public int incomeCalculate() {
public void setPassedDays(int passedDays) {
this.passedDays += passedDays;
}
public int incomeCalculate() {
this.income = (overTime * 500) + this.defPay;
return this.income;
}
@Override
public boolean isPromoteable() {
return false;
if (this.passedDays > 365 * 3) {
this.passedDays = 0;
return true;
} else
return false;
}
@Override
public int calCurrentIncome() {
return 0;
}
@Override
public AbstarctEmployee callEmployee() {
return null;
}
}
......@@ -11,6 +11,10 @@ public class Student extends Person {
this.courses = courses;
}
public void addCourse(Course course) {
courses.add(course);
}
public ArrayList<Course> getCourses() {
return this.courses;
}
......
......@@ -5,25 +5,51 @@ import java.util.ArrayList;
public class Teacher extends AbstarctEmployee {
private ArrayList<Course> courses;
private ArrayList<Essay> essays;
private String group;
public Teacher(String firstName, String lastName, String ID, int joiningYear, Department department, int defPay, ArrayList<Payroll> payrolls, ArrayList<Course>courses) {
super(firstName, lastName, ID, joiningYear, department, defPay, payrolls);
public Teacher(String firstName, String lastName, String ID, int joiningYear, Department department, int defPay, ArrayList<Payroll> payrolls, String state, String group) {
super(firstName, lastName, ID, joiningYear, department, defPay, payrolls, state);
this.courses = courses;
this.group = group;
}
private void addCourse(Course course) {
this.courses.add(course);
}
private void removeCourse(Course course){
private void removeCourse(Course course) {
this.courses.remove(course);
}
public int incomeCalculate(){
public void addEssay(Essay essay) {
this.essays.add(essay);
}
public ArrayList<Essay> getEssays() {
return essays;
}
public int incomeCalculate() {
this.income = (this.essays.size() * 1000) + this.defPay;
return this.income;
}
@Override
public boolean isPromoteable() {
return false;
if (essays.size() > 10)
return true;
else
return false;
}
@Override
public int calCurrentIncome() {
return 0;
}
@Override
public AbstarctEmployee callEmployee() {
return null;
}
}
package org.university.core;
public class Type {
private String type;
public Type(String type) {
this.type = type;
}
public String getType() {
return type;
}
}
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