public void evaluateCredit( Client client, double creditMoney, Credit.CreditType creditType, int period) { double allMonthlyPayments = 0; for (Credit credits : client.getCredits()) { allMonthlyPayments += credits.getMonthlyPayment(); } if (allMonthlyPayments < client.getSalary() / 2) { if (this.reserve - creditMoney > this.getAllDepositMoney() * 0.1) { this.createCredit(client, creditMoney, creditType, period); System.out.println(this.name + " gave " + client.getName() + " a credit of " + creditMoney); this.allDepositMoney -= creditMoney; } else { System.out.println("The bank cannot afford to give this credit."); } } else { System.out.println(client.getName() + " cannot afford to pay this credit."); } }
private void createCredit( Client client, double creditMoney, Credit.CreditType creditType, int period) { bankProducts.add(new Credit(client.getName() + "'s Credit", creditMoney, creditType, period)); client.addCredit(new Credit(client.getName() + "'s Credit", creditMoney, creditType, period)); }
public void acceptDeposit(Client client, double deposit, Deposit.DepositType type) { this.allDepositMoney += deposit; this.reserve += (0.9 * deposit); bankProducts.add(new Deposit(client.getName() + "'s deposit", deposit, type)); }