public Atm() // constructor // sets the customer array to that found in the file if the file exists { try { // Set cross-platform Java L&F (also called "Metal") UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (UnsupportedLookAndFeelException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } if (logFile.exists()) { try { adminLogs = returnLog("p2.log"); if (!adminLogs.isEmpty()) { // there may be customer data but perhaps no transactions yet. ArrayList<Integer> allTransactions = new ArrayList<>(100); for (AdminLog a : adminLogs) { int transaction = a.getTransactionID(); ; allTransactions.add(transaction); } transaction_counter = Collections.max(allTransactions) + 1; } } catch (ClassNotFoundException | IOException e) { e.printStackTrace(); } } if (DBfile.exists()) { try { cust = returnSavedData("p2.dat"); // sets the starting ID to the max of all the IDs stored in the file. allIDs = new ArrayList<Integer>(100); ArrayList<Integer> allAccounts = new ArrayList<>(); for (Customer customer : cust) { String idString = customer.returnID(); int id = Integer.parseInt(idString); allIDs.add(id); int accountNumber = customer.returnMaxAccount(); allAccounts.add(accountNumber); } // checks to see if the customer has even made any accounts, if not, max accounts will be // set at 1001 if (starting_account_number != 1) { starting_account_number = Collections.max(allAccounts) + 1; } starting_customer_number = Collections.max(allIDs) + 1; } catch (ClassNotFoundException | IOException e) { e.printStackTrace(); } } else { cust = new ArrayList<>(100); // creates the file if it does not exist try { saveFile(cust, DBfile); } catch (IOException e) { e.printStackTrace(); } } interest_rate = 5; }