:Bank Accounts currently in Account List Array:
Account Name: Morgan Checking A/c no:14213 Balance in A/c: €1000.0
Account Name: Rory Checking A/c no:13213 Balance in A/c: €1050.0
Account Name: Jake Savings A/c no:12464 Balance in A/c: €1430.0
Account Name: joe savings A/c no:2345 Balance in A/c: €2345.0
I have scanned that back in to program using code below.
File file = new File("BankAccounts.txt");
int ch;
StringBuffer strContent = new StringBuffer("");
FileInputStream fin = null;
try {
fin = new FileInputStream(file);
while ((ch = fin.read()) != -1)
strContent.append((char) ch);
fin.close();
}
catch (Exception e) {
System.out.println(e);
}
System.out.println("\nPrinting output of Read File");
System.out.println( strContent.toString());
I want to add this infoback into an arraylist of type Bank_AC. All along I have been adding in accounts into arraylist by instantiating using the following
TSB1.accountList.add(new Savings ("Matt Savings", 12345, 222.22, 20,400));
public abstract class Bank_AC //constructor for superclass
{
private String name; //Declaring variable
private int accNo;
private double int_rate, overdraft; //Declaring variables for class
protected double bal;
Bank_AC (String realname, int AccNo, Double InitialBal, double i,double Overdraft)
{
name = realname;//Initializing variables to parameters above
accNo= AccNo;
bal = InitialBal;
int_rate = i;
overdraft = Overdraft;
}
What do I need to do now?

New Topic/Question
Reply



MultiQuote








|