{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Driver - 400 2.5 i3 = new "Gus" 7 300 5 i4 = new...

Info icon This 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,
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern