import java.util.*;
import java.io.*;
public class ConcreteClass
{
private String fileName = "List.txt";
private Customer[] clients = null;
public static void main(String[] args) throws Exception
{
ConcreteClass first = new ConcreteClass();
first.readFile();
first.showCustomers();
System.out.println("Hello World");
}
public void showIntro()
{
System.out.println("---------BANKING MANAGEMENT PROGRAM---------");
System.out.println("1---Show list of customers.");
System.out.println("2---Add a Customer bank account ");
System.out.println("3---Remove a Customer bank account ");
System.out.println("4---Sort customer list according to name");
System.out.println("5---Sort customer list according to account balance");
}
public void readFile() throws Exception
{
int index = 0;
Scanner reader = new Scanner(new File(fileName));
int count=0;
while(reader.hasNextLine())
{
count++;
}
while(reader.hasNextLine())
{
String[] roster = reader.nextLine().split(",");
String fName = roster[0];
String lName = roster[1];
String mName = roster[2];
double balance = Double.parseDouble(roster[3]);
String accNo = roster[4];
Account b = new Account(balance,accNo);
Customer c = new Customer(fName,lName,mName,b);
clients = new Customer[count];
clients[index++] = c;
}
reader.close();
}
public void showCustomers()
{
for(int i =0; i<clients.length; i++)
{
System.out.println(clients[i].toString());
}
}
}
Account(balance,account number)-toString(): ("Account Number: "+getNumber()+"/n Account Balance: "+getBalance())
Customer(fName,lName,mName,account)-toString(): ("Customer Name:"+getFirstName()+" "+getMidName()+" "+getLastName()+" Customer Account:"+getAccount())