Commit 64450784 authored by Roham's avatar Roham

Second

parent 7206aba8
Pipeline #587 failed with stages
package org.university.core;
public class Account {
private Employee employee;
private int balance;
public Account(Employee employee) {
this.employee = employee;
balance = 0;
}
public void checkout(double income){
balance += income;
}
public Employee getEmployee() {
return employee;
}
public double getBalance() {
return balance;
}
}
package org.university.core;
import java.util.ArrayList;
public class AccountingManagement {
private ArrayList<Account> accounts;
private ArrayList<Statement> transactions;
public AccountingManagement() {
this.accounts = new ArrayList<>();
this.transactions = new ArrayList<>();
}
public void addAccount(Account account)
{
this.accounts.add(account);
}
public void settle()
{
for (int i = 0 ; i < accounts.size(); i++)
{
accounts.get(i).checkout(accounts.get(i).getEmployee().calCurrentIncome() + accounts.get(i).getEmployee().getBasicIncome());
transactions.add(new Statement(accounts.get(i).getEmployee().calCurrentIncome() + accounts.get(i).getEmployee().getBasicIncome() , accounts.get(i).getEmployee()));
}
}
public ArrayList<Statement> getTransactions() {
return transactions;
}
}
......@@ -6,6 +6,7 @@ public abstract class Employee extends Person {
protected ArrayList<Statement> bankStatements;
protected String position;
protected double basicIncome;
protected double requiredIncome;
public Employee(String firstName, String lastName, String id, int joiningYear, Department department, String position, double basicIncome) {
super(firstName, lastName, id, joiningYear, department);
......@@ -31,6 +32,10 @@ public abstract class Employee extends Person {
this.basicIncome = basicIncome;
}
public double getBasicIncome() {
return basicIncome;
}
public abstract double calCurrentIncome();
public abstract Boolean isPromotable();
}
......@@ -31,6 +31,7 @@ public class Professor extends Employee{
public double calCurrentIncome()
{
return requiredIncome;
}
public Boolean isPromotable()
......
......@@ -6,6 +6,7 @@ public class ServiceEmployee extends Employee{
}
public double calCurrentIncome()
{
return requiredIncome;
}
public Boolean isPromotable()
{
......
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