This repository was archived by the owner on Nov 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Bank
Matthew Pohlmann edited this page Jan 1, 2014
·
1 revision
####Description A Bank in SimCity201. People can have accounts, withdraw and deposit money, and take out loans.
####Class Signature
public class Bank extends Structure {}####Data
List<BankTellerRole> bankTellers;
BankGuardRole bankGuard;
boolean isOpen;
double bankBalance;public enum AccountTypes { BUSINESS, PERSONAL }
HashMap<int actNumber, double balance> personalAccounts;
HashMap<int actNumber, double balance> businessAccounts;####Constructors
public Bank(int x, int y, int width, int height) {
super(x, y, width, height);
}####Methods
// Returns a list of this Bank's tellers
public List<BankTellerRole> getTellers() {
return bankTellers;
}// Returns the bank's guard
public BankGuardRole getGuard() {
return bankGuard;
}// Returns SimCity201's personal accounts
public HashMap<int actNumber, double balance> getPersonalAccounts() {
return personalAccounts;
}// Returns SimCity201's business accounts
public HashMap<int actNumber, double balance> getBusinessAccounts() {
return businessAccounts;
}// Returns the total money held inside of the Bank (Useful for granting loans)
public double getBankBalance() {
for(int actNum : personalAccounts.keySet()) {
bankBalance += personalAccounts.get(actNum);
}
for(int actNum : businessAccounts.keySet()) {
bankBalance += businessAccounts.get(actNum);
}
return bankBalance;
}// Sets whether this Bank is open or closed
public void setOpen(boolean open) {
isOpen = open;
}// Returns whether or not this Bank is open
public boolean getOpen() {
return isOpen;
}