Driver - 400, 2.5); InterestBearingAccount i3 = new

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
// Driver for discussion 4 // COP 3503 public class Driver { public static void main(String[] args) { // create a bunch of Checking accounts CheckingAccount c1 = new CheckingAccount("Martin", 1, 500, 1); CheckingAccount c2 = new CheckingAccount("Julie", 2, 10000, 100); CheckingAccount c3 = new CheckingAccount("Kyle", 3, 40000, 200); CheckingAccount c4 = new CheckingAccount("Shayan", 4, 5000, 50); // deposit/withdraw c1.checkTransaction(100); // should work c1.checkTransaction(200); // can't withdraw c1.deposit(1000); c2.withdraw(9800); // withdraw c2.withdraw(3000); // cannot withdraw // Interest accounts InterestBearingAccount i1 = new InterestBearingAccount("Walter", 5); InterestBearingAccount i2 = new InterestBearingAccount("Jessie", 6,
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 400, 2.5); InterestBearingAccount i3 = new InterestBearingAccount("Gus", 7, 300, 5); InterestBearingAccount i4 = new InterestBearingAccount("Sookie", 8, 1200, 7); // monthly interest i1.addMonthlyInterest(); i1.addMonthlyInterest(); i2.addMonthlyInterest(); i3.addMonthlyInterest(); // Create a Bank Account accounts = {c1, c2, c3, c4, i1, i2, i3, i4}; Bank bank = new Bank(accounts); // sort by balance first System.out.println("Sorting by balance: "); bank.sortByBalance(); bank.printAccounts(); // sort by owners System.out.println("\nSorting by owner: "); bank.sortByOwner(c1); bank.printAccounts(); } }...
View Full Document

This note was uploaded on 02/15/2012 for the course COP 3503 taught by Professor Staff during the Spring '12 term at University of Florida.

Ask a homework question - tutors are online