Assignment Five Hints

Here is the class we wrote in class:

For the assignment, your main should be creating one Bank object and a number of BankAccount objects (though you will not have to declare any BankAccount objects in main). Your main should be calling the createNewAccount(...) function of your Bank to create new accounts.
It should not be creating any arrays: the array of BankAccount objects is declared as a private member variable of the Bank object.
You may also want to declare a private member variable that keeps track of the number of BankAccount objects currently held by your bank.

Here is a sample main, note that it is not complete! You need to add a few more accounts, not to mention some comments:

public class BankRunner {
	public static void main( String[] args) {
		Bank firstNational = new Bank();
		firstNational.createNewAccount("Erik", "ooga2booga" 300);
		firstNational.createNewAccount("Kristin", "iluv$s", 40000);

		System.out.println("Here's the stats before the years:");
		System.out.println("  The average balance is $" + firstNational.averageBalance());
		System.out.println("  The high balance is $" + firstNational.highBalance());
		System.out.println("  The low balance is $" + firstNational.lowBalance());
		System.out.println("  The median balance is $" + firstNational.medianBalance());

		for( int index = 1; index <= 24; index++) {
		    double interestPaid = firstNational.monthlyUpdate();
		    System.out.println("oooh, I had to pay out $" + interestPaid);
		}
	
		System.out.println("Here's the stats after the years:");
		System.out.println("  The average balance is $" + firstNational.averageBalance());
		System.out.println("  The high balance is $" + firstNational.highBalance());
		System.out.println("  The low balance is $" + firstNational.lowBalance());
		System.out.println("  The median balance is $" + firstNational.medianBalance());
	
	}
}

The views and opinions expressed in this page are strictly those of the page author.
The contents of this page have not been reviewed or approved by the University of Minnesota.