All pastes #42325 Raw Edit

Stuff

public text v1 · immutable
#42325 ·published 2006-02-20 21:24 UTC
rendered paste body
	public String getReport() {
		String report = "";
		int balance = 0;
		
		for(int i = 0; i < getTransactionCount(); i++) {
			if (getTransaction(i).getType().equals("d")) {
				report = report + "Deposit: " + getTransaction(i).getAmount() + "\n";
				balance += getTransaction(i).getAmount(); 
			}
			else if (getTransaction(i).getType().equals("w")) {
				report = report + "Withdrawal: -" + getTransaction(i).getAmount() + "\n";
				balance -= getTransaction(i).getAmount(); 
			}
			else if (getTransaction(i).getType().equals("f")) {
				report = report + "Fee: -" + getTransaction(i).getAmount() + "\n";
				balance -= getTransaction(i).getAmount(); 
			}
		}
		
		report = report + "\n\n" + "Balance: " + balance;		
		return report;
	}