package net.java_school.javabank; import java.io.*; public class BankCUI { private Bank bank = new Bank(); { // Å×½ºÆ® µ¥ÀÌÅÍ bank.addCustomer("kim", "±èÅÂÈñ"); bank.addCustomer("park", "¹ÚÁö¼º"); Customer customer = bank.getCustomer("kim"); customer.addAccount("111", 1000); customer = bank.getCustomer("park"); customer.addAccount("222", 500); } public BankCUI() throws IOException { showMenu(); } public void showMenu() throws IOException { String menu = null; String id = null; String name = null; do { System.out.println(" ** ¸Þ´º¸¦ ¼±ÅÃÇϼ¼¿ä ** "); System.out.println(" 1 *** °í°´ µî·Ï "); System.out.println(" 2 *** °í°´ °Ë»ö "); System.out.println(" 3 *** °í°´ ¸ñ·Ï "); System.out.println(" 4 *** °èÁ »ý¼º "); System.out.println(" 5 *** ÀÔ±Ý "); System.out.println(" 6 *** Ãâ±Ý "); System.out.println(" q *** Á¾·á "); System.out.println(" ********************** "); System.out.print(">>"); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); menu = br.readLine(); try { if ( menu.equals("1") ) { // °í°´ µî·Ï System.out.print("¾ÆÀ̵𸦠ÀÔ·ÂÇϼ¼¿ä>>"); id = br.readLine(); System.out.print("À̸§À» ÀÔ·ÂÇϼ¼¿ä>>"); name = br.readLine(); bank.addCustomer(id, name); Customer customer = bank.getCustomer(id); System.out.print("°èÁ¹øÈ£¸¦ ÀÔ·ÂÇϼ¼¿ä>>"); String accountNo = br.readLine(); System.out.print("Ãʱâ Àܾ×À» ÀÔ·ÂÇϼ¼¿ä>>"); long balance = Long.parseLong(br.readLine()); customer.addAccount(accountNo, balance); } else if ( menu.equals("2") ) { // °í°´ °Ë»ö System.out.print("¾ÆÀ̵𸦠ÀÔ·ÂÇϼ¼¿ä>>"); id = br.readLine(); Customer customer = bank.getCustomer(id); System.out.println( customer.getId() + ":" + customer.getName()); Account[] accounts = customer.getAccounts(); int totalAccount = customer.getTotalAccount(); for ( int i = 0; i < totalAccount; i++ ) { System.out.println( "\t" + "°èÁ¹øÈ£:" + accounts[i].getAccountNo() + " Àܰí:" + accounts[i].getBalance() + "¿ø"); } } else if ( menu.equals("3") ) { // °í°´ ¸ñ·Ï Customer[] customers = bank.getCustomers(); int totalCustomer = bank.getTotalCustomer(); for ( int i = 0; i < totalCustomer; i++ ) { System.out.println( customers[i].getId() + ":" + customers[i].getName()); Account[] accounts = customers[i].getAccounts(); int totalAccount = customers[i].getTotalAccount(); for ( int j = 0; j < totalAccount; j++ ) { System.out.println( "\t" + "°èÁ¹øÈ£:" + accounts[j].getAccountNo() + " Àܰí:" + accounts[j].getBalance() + "¿ø"); } System.out.println("--------------------------------"); } } else if (menu.equals("4")) { // °èÁ »ý¼º } else if (menu.equals("5")) { // ÀÔ±Ý } else if (menu.equals("6")) { // Ãâ±Ý } System.out.println(); }catch (Exception e) { System.out.println(e.getMessage()); } } while ( !menu.equals("q") ); } public static void main(String[] args) throws IOException { new BankCUI(); } }