Commit 8a026070 authored by Amirhosein Rajabpour's avatar Amirhosein Rajabpour

interface commit

parent 5f84f1ae
...@@ -3,11 +3,13 @@ package org.university.core; ...@@ -3,11 +3,13 @@ package org.university.core;
public class Account public class Account
{ {
private AbstractEmployee owner; private AbstractEmployee owner;
private double credit; private double credit = 0;
private double demand = 0;
public Account(AbstractEmployee owner, double credit) { public Account(AbstractEmployee owner, double credit) {
this.owner = owner; this.owner = owner;
this.credit = credit; this.credit = credit;
this.demand = 0;
} }
public AbstractEmployee getOwner() { public AbstractEmployee getOwner() {
...@@ -25,4 +27,12 @@ public class Account ...@@ -25,4 +27,12 @@ public class Account
public void setCredit(double credit) { public void setCredit(double credit) {
this.credit = credit; this.credit = credit;
} }
public double getDemand() {
return demand;
}
public void setDemand(double demand) {
this.demand = demand;
}
} }
\ No newline at end of file
...@@ -12,10 +12,10 @@ public class AccountingManagement ...@@ -12,10 +12,10 @@ public class AccountingManagement
boolean flag = true; boolean flag = true;
for (Account account:accounts) for (Account account:accounts)
{ {
if (account.getOwner()==employee) if (account.getOwner()== employee)
{ {
double amount = employee.callCurrentIncome(); double amount = employee.callCurrentIncome();
account.setCredit(account.getCredit()+amount); account.setCredit(account.getCredit() + amount);
flag = false; flag = false;
Statement s = new Statement(amount,employee.callEmployee()); Statement s = new Statement(amount,employee.callEmployee());
statements.add(s); statements.add(s);
...@@ -31,4 +31,14 @@ public class AccountingManagement ...@@ -31,4 +31,14 @@ public class AccountingManagement
} }
} }
public void settle(AccountingInterface employee){
for(Account account:accounts){
if(account.getOwner() == employee){
if(account.getDemand() > 0){
account.setCredit(account.getCredit() + account.getDemand());
account.setDemand(0);
}
}
}
}
} }
...@@ -30,4 +30,8 @@ public class Professor extends AbstractEmployee ...@@ -30,4 +30,8 @@ public class Professor extends AbstractEmployee
} }
@Override
public AbstractEmployee callEmployee() {
return null;
}
} }
...@@ -24,6 +24,10 @@ public class ServiceEmployee extends AbstractEmployee ...@@ -24,6 +24,10 @@ public class ServiceEmployee extends AbstractEmployee
else else
return false; return false;
} }
@Override
public AbstractEmployee callEmployee() {
return null;
}
} }
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