{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

bank - import import import import import java.io.File...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.io.File; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.util.*; import java.util.Scanner; public class Bank //implements Cloneable { private Account[] accounts; public Bank(Account[] accounts) { this.accounts = accounts; } // sort by compareTo public void sortByBalance() { Arrays.sort(accounts); } // sort by compare public void sortByOwner(Account a) { Arrays.sort(accounts, a); } public void modifyAccountBalance(int i, double balance) { if (i > accounts.length) return; if (accounts[i] == null) return; accounts[i].setBalance(balance); } // clone /*public Object clone() { Account acc2 = new Account[acounts.length]; for(int i = 0; i<acc2.length; i++) { if(account[i] instanceof CheckingAccount) acc2[i]=(CheckingAccount) ((CheckingAccount)account[i]).clone(); if(account[i] instanceof InterestAccount) acc2[i]=(InterestAccount) ((InterestAccount)account[i]).clone(); } Bank bank = new Bank(acc2); return bank; }*/ // writes to file /*public void writeToFile(String outputFile) { File file = new File(outputFile); try { printerWriter output = new PrinterWriter(file);
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}