Commit 7efa2917 authored by 9731050's avatar 9731050

5th

parent 6946658a
package org.university.core;
public class Account
{
public class Account {
private AbstractEmployee owner;
private double credit;
private double demand;
public Account(AbstractEmployee owner, double credit) {
this.owner = owner;
this.credit = credit;
demand=0;
}
public AbstractEmployee getOwner() {
......@@ -25,4 +25,12 @@ public class Account
public void setCredit(double credit) {
this.credit = credit;
}
public double getDemand() {
return demand;
}
public void setDemand(double demand) {
this.demand = demand;
}
}
\ No newline at end of file
......@@ -5,22 +5,23 @@ import java.util.ArrayList;
public class AccountingManagement {
private ArrayList<Account> accounts;
private ArrayList<Statement> statements;
public void checkout(AccountingInterface employee)
{
public void checkout(AccountingInterface employee) {
boolean command = true;
for (Account account:accounts)
{
if (account.getOwner()==employee)
{
for (Account account:accounts) {
if (account.getOwner()==employee) {
double amount = employee.callCurrentIncome();
account.setCredit(account.getCredit()+amount);
command = false;
Statement s = new Statement(amount,employee.callEmployee());
statements.add(s);
if(account.getDemand() > 0){
account.setCredit(account.getCredit() + account.getDemand());
account.setDemand(0);
}
}
}
if (command)
{
if (command) {
double amount = employee.callCurrentIncome();
Account ac = new Account(employee.callEmployee(),employee.callCurrentIncome());
accounts.add(ac);
......
package org.university.core;
public class Article{
private String title;
private int year;
public Article(String title, int year) {
this.title = title;
this.year = year;
}
public String getTitle() {
return title;
}
public int getYear() {
return year;
}
}
package org.university.core;
import java.sql.Statement;
import java.util.ArrayList;
public class Employee extends Person {
protected ArrayList<Statement> bankStatement;
protected String position;
protected double basicIncome;
public Employee(String firstName, String lastName, String ID, int joiningYear, Department department,String position,double basicIncome) {
super(firstName, lastName, ID, joiningYear, department);
this.position=position;
bankStatement=new ArrayList<Statement>();
this.basicIncome=basicIncome;
}
public ArrayList<Statement> getBankStatement() {
return bankStatement;
}
public void addBankstatement(Statement statement){
bankStatement.add(statement);
}
public String getPosition() {
return position;
}
public void setBasicIncome(double income){
basicIncome=income;
}
}
......@@ -18,5 +18,5 @@ public class GradStudent extends Student{
return publications;
}
// public int calCurrentIncome(){}
}
......@@ -2,27 +2,49 @@ package org.university.core;
import java.util.ArrayList;
public class Professor extends Employee{
private ArrayList<Course>courses;
public class Professor extends AbstractEmployee {
private double income = 0;
private ArrayList<Course> courses;
private ArrayList<Article> articles;
private String group;
public Professor(String firstName, String lastName, String ID, int joiningYear, Department department, String position, double basicIncome,String group) {
public Professor(String firstName, String lastName, String ID, int joiningYear,
Department department, String position, double basicIncome, String group) {
super(firstName, lastName, ID, joiningYear, department, position, basicIncome);
courses=new ArrayList<>();
this.group=group;
this.group = group;
this.income = 0;
}
public ArrayList<Course> getCourses() {
return courses;
public void income(Professor professor){
income = (professor.articles.size()*1000) + basicIncome;
}
public String getGroup() {
return group;
public void setIncome(double income) {
this.income = income;
}
public void addCourse(Course c){
courses.add(c);
public double getIncome() {
return income;
}
public double getCurrentIncome(){
public void addArticle(Article a){
articles.add(a);
}
public ArrayList getArticles(){
return articles;
}
@Override
public boolean isPromotable() {
if(articles.size()>10)
return true;
else
return false;
}
@Override
public AbstractEmployee callEmployee() {
return null;
}
}
package org.university.core;
public class ServiceEmployee extends Employee {
import java.util.Date;
public class ServiceEmployee extends AbstractEmployee {
double income;
int additionalHour;
int passedDays;
public ServiceEmployee(String firstName, String lastName, String ID, int joiningYear, Department department, String position, double basicIncome) {
super(firstName, lastName, ID, joiningYear, department, position, basicIncome);
this.income = 0;
income=0;
additionalHour=0;
passedDays=0;
}
public void setPassedDays(int passedDays) {
this.passedDays++;
}
public void income(ServiceEmployee serviceEmployee){
income = ( additionalHour*500) + basicIncome;
}
public double getIncome() {
return income;
}
public double getCurrentIncome(){
public void setIncome(double income) {
this.income = income;
}
public void setAdditionalHour(int additionalHour) {
this.additionalHour = additionalHour;
}
@Override
public boolean isPromotable() {
if(passedDays > 365*3 ){
passedDays = 0;
return true;
}
else
return false;
}
@Override
public AbstractEmployee 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;
}
}
\ No newline at end of file
package org.university.core;
public class UnderGradStudent extends Student {
public UnderGradStudent(String firstName, String lastName, String ID, int joiningYear, Department department) {
private Type filed;
public UnderGradStudent(String firstName, String lastName, String ID, int joiningYear, Department department,Type filed) {
super(firstName, lastName, ID, joiningYear, department);
this.filed=filed;
}
public void setFiled(Type filed){
this.filed=filed;
}
public Type getFiled() {
return filed;
}
}
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