public double getBalance(string accountNumber, int startDay, int endDay ) { double ret = 0; Account actAccount = this.findAccountByAccountNumber(accountNumber); if (actAccount != null) { Transaction[] tmpTransactions = new Transaction[TransactionTrunk.MAX_TRANSACTION]; int tmpTranNum = 0; for (int i = 0; i < this.actTransaction; i++) { if (this.transactions[i].BaseAccount.Equals(actAccount)) { if (this.transactions[i].Day >= startDay) { if (this.transactions[i].Day <= endDay) { ret += this.transactions[i].getValue(); } } } } } return ret; }
private void addTransaction( Transaction transaction ) { if (this.actTransaction < TransactionTrunk.MAX_TRANSACTION) { this.transactions[this.actTransaction++] = transaction; } }