import java.io.*;
import java.util.*;

class Account {
    // instance variables
    private int AccountNo;
    private String OpenDate;
    private double AccountBalance;
    private String type;
    // constructor
    public Account(int AccountNo,String OpenDate,double AccountBalance,String type) {
        this.AccountNo = AccountNo;
        this.OpenDate = OpenDate;
        this.AccountBalance = AccountBalance;
        this.type = type;
    }
    
    //Methods
    public void searchAcc(Account[] x) {
        
    }
    
    public void delAcc(int idAcc) {
        
    }
    public void DisplayAcc() {
        
    }
    public void DisplayAccCu() {
        
    }
    public void Deposit(double money) {
        AccountBalance += money;
    }
    public void Transfer(double money) {
        
    }
    public void WithDraw(double money) {
        AccountBalance -= money;
    }
}

class Customer {
    //Instance Variables
    private String firstName;
    private String lastName;
    private String ID;
    private String Phone;
    private String AccountNos[];
    
    
    //Constructor
    
    public Customer(String firstName,String lastName,String ID,String Phone,String AccountNos []) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.ID = ID;
        this.Phone = Phone;
        this.AccountNos = AccountNos;
    }
    
    // Methods
    public void newCustomer(String FirstName,String LastName,int id,int phone) {
        
    }
    public void DelCustomer(int id) {
        
    }
    public void display() {
        System.out.println("Customer's first name : " + firstName + "\tCustomer's last name : " +lastName + "\tCustomer's ID : " + ID + "\tPhone number : " + Phone + "\tCustomer Account(s) : " + AccountNos);
    }
    public void searchCus() {
        
    }
}


class BankingSystem {
    Customer [] customers = new Customer [1000];
    int customerCount = 0;
    
    public static void main(String[] args) throws IOException {
        
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        BufferedReader fileread = new BufferedReader(new FileReader("A:\bank.txt"));
        PrintWriter filewrite = new PrintWriter(new FileWriter("A:\bank.txt"));
        Account[] AccArray = new Account[99999];
        Customer[] CusArray = new Customer[30];
        
        int choise=0;
        int choise2=0;
        int choise3=0;
        
        //customer info.
        String CusFNa;
        String CusLNa;
        int CusID;
        int CusPhone;
        int CusSearch;
        //account info.
        double accbal;
        String accType;
        int accId;
        String accDate;
        int idEnt;
        
        
        System.out.println("(Dhahran International Bank)\n");
        
        do {
            switch (mainMenu()) {
                case 1:
                    switch(operationsMenu()) {
                        case 1:
                            int n =0;
                            System.out.println("\n1.1 Add new account");
                            System.out.print("\nEnter the account ID# (5 digits): ");
                            accId = Integer.parseInt(stdin.readLine());
                            while(accId>99999 || accId<10000) {
                                System.out.print("Wrong Input!!");
                                System.out.print("\nEnter the account ID# (5 digits): ");
                                accId = Integer.parseInt(stdin.readLine());
                            }
                            
                            System.out.print("Enter the account open Date (dd-mm-yyyy): ");
                            accDate = stdin.readLine();
                            StringTokenizer tokDate = new StringTokenizer(accDate,"-",true);
                            
                            
                            System.out.print("Enter the account balance: ");
                            accbal = Double.parseDouble(stdin.readLine());
                            
                            System.out.print("Enter the account type: ");
                            accType = stdin.readLine();
                            System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
                            
                            Account Acc = new Account(accId,accDate,accbal,accType);
                            AccArray[n] = Acc;
                            n++;
                            
                            break;
                        case 2:
                            System.out.println("\n1.2 Delete an existing account");
                            System.out.print("\nEnter the acount ID#(5 digits): ");
                            idEnt=Integer.parseInt(stdin.readLine());
                            while(idEnt>99999 || idEnt<10000) {
                                System.out.print("Wrong Input!!");
                                System.out.print("\nEnter the account ID# (5 digits): ");
                                idEnt = Integer.parseInt(stdin.readLine());
                            }
                            System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
                            break;
                            
                        case 3:
                            System.out.println("\n1.3 Display all information of a particular account");
                            System.out.print("\nEnter the acount ID#(5 digits): ");
                            idEnt=Integer.parseInt(stdin.readLine());
                            while(idEnt>99999 || idEnt<10000) {
                                System.out.print("Wrong Input!!");
                                System.out.print("\nEnter the account ID# (5 digits): ");
                                idEnt = Integer.parseInt(stdin.readLine());
                            }
                            System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
                            break;
                            
                        case 4:
                            System.out.println("\n1.4 Display all accounts of a customer");
                            System.out.print("\nEnter the customer ID#: ");
                            idEnt=Integer.parseInt(stdin.readLine());
                            System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
                            break;
                        case 5:
                            System.out.println("\n1.5 Deposit ");
                            System.out.print("\nEnter the acount ID#(5 digits): ");
                            idEnt=Integer.parseInt(stdin.readLine());
                            while(idEnt>99999 || idEnt<10000) {
                                System.out.print("Wrong Input!!");
                                System.out.print("\nEnter the account ID# (5 digits): ");
                                idEnt = Integer.parseInt(stdin.readLine());
                            }
                            
                            int dispote=0;
                            System.out.print("\nEnter the amount of dispote: ");
                            dispote=Integer.parseInt(stdin.readLine());
                            System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
                            break;
                            
                        case 6:
                            System.out.println("\n1.6 Transfer");
                            int transfer;
                            int targacc;
                            int money;
                            
                            System.out.print("\nEnter the acount ID#(5 digits): ");
                            idEnt=Integer.parseInt(stdin.readLine());
                            while(idEnt>99999 || idEnt<10000) {
                                System.out.print("Wrong Input!!");
                                System.out.print("\nEnter the account ID# (5 digits): ");
                                idEnt = Integer.parseInt(stdin.readLine());
                            }
                            
                            System.out.print("Enter the target account ID#(5 digits): ");
                            targacc=Integer.parseInt(stdin.readLine());
                            while(targacc>99999 || targacc<10000) {
                                System.out.print("Wrong Input!!");
                                System.out.print("\nEnter the target account ID# (5 digits): ");
                                targacc=Integer.parseInt(stdin.readLine());
                            }
                            
                            System.out.print("Enter the amount of money: ");
                            money=Integer.parseInt(stdin.readLine());
                            System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
                            break;
                            
                        case 7:
                            System.out.println("\n1.7 Withdraw");
                            //int money;
                            
                            System.out.print("\nEnter the acount ID#(5 digits): ");
                            idEnt=Integer.parseInt(stdin.readLine());
                            while(idEnt>99999 || idEnt<10000) {
                                System.out.print("Wrong Input!!");
                                System.out.print("\nEnter the account ID# (5 digits): ");
                                idEnt = Integer.parseInt(stdin.readLine());
                            }
                            
                            System.out.print("Enter the amount of money: ");
                            money=Integer.parseInt(stdin.readLine());
                            System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
                            break;
                            
                        case 8:
                            break;
                            
                        default :
                            System.out.println("Wrong Input!!");
                            
                    }
                    break;
                    
                    
                case 2:
                    System.out.println("\n\n2.1 Add a new customer");
                    System.out.println("2.2 Delete a customer.");
                    System.out.println("2.3 Display information of a particular customer");
                    System.out.println("2.4 Return to the main menu");
                    
                    System.out.print("\nselect the procces (1,2,3 or 4): ");
                    choise3 = Integer.parseInt(stdin.readLine());
                    System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
                    switch (choise3) {
                        case 1: {
                            System.out.println("\n2.1 Add a new customer");
                            System.out.print("\nEnter the customer First Name: ");
                            CusFNa = stdin.readLine();
                            System.out.print("Enter the customer Last Name: ");
                            CusLNa = stdin.readLine();
                            System.out.print("Enter the customer ID#: ");
                            CusID = Integer.parseInt(stdin.readLine());
                            System.out.print("Enter the customer Phone#: ");
                            CusPhone = Integer.parseInt(stdin.readLine());
                            System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
                            break;
                        }
                        case 2: {
                            System.out.println("\n2.2 Delete a customer.");
                            System.out.print("\nEnter the customer ID#: ");
                            CusSearch = Integer.parseInt(stdin.readLine());
                            System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
                            break;
                        }
                        case 3: {
                            System.out.println("\n2.3 Display information of a particular customer");
                            System.out.print("\nEnter the customer ID#: ");
                            CusSearch = Integer.parseInt(stdin.readLine());
                            System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
                            break;
                        }
                        case 4: {
                            break;
                        }
                        default: {
                            System.out.print("Wrong Input!!");
                        }
                    }
                    break;
                    
                    
                case 3:break;
                
                default:
                    System.out.println("Wrong Input !!");
                    break;
                    
            }
        }
        while (choise!=3);
        
        fileread.close();
        filewrite.close();
    }
    
    static int mainMenu() throws IOException{
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("\n1. Accounts Operations");
        System.out.println("2. Customers Operations");
        System.out.println("3. Exit\n");
        
        System.out.print("select the operation (1,2 or 3): ");
        System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
        return Integer.parseInt(stdin.readLine());
    }
    
    static int operationsMenu() throws IOException{
        BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
        System.out.println("\n\n1.1 Add new account");
        System.out.println("1.2 Delete an existing account");
        System.out.println("1.3 Display all information of a particular account");
        System.out.println("1.4 Display all accounts of a customer");
        System.out.println("1.5 Deposit ");
        System.out.println("1.6 Transfer");
        System.out.println("1.7 Withdraw");
        System.out.println("1.8 Return to the main menu");
        System.out.print("\nselect the procces (1,2 ... or 8): ");
        System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++");
        return Integer.parseInt(stdin.readLine());
        
    }
    Customer [] loadCustomers(){
        return new Customer [1000];
    }
}