Java

자바 CRUD 메모리 저장 방식

NellKiM 2024. 9. 26. 16:36

JAVA CRUD 기본 형식

private static void menu() {

 

System.out.println("-----------------------------------");

System.out.println("1.예금 | 2.출금 | 3.잔고| 4.종료");

System.out.println("-----------------------------------");

}

 

 

 

 

 

 

private static void call12() {

Scanner sc = new Scanner(System.in);

//flag 값 주어짐 while 탈출할때 용이함

boolean isStop = false;

int total = 0;

while (!isStop) {

 

menu();

 

System.out.print("선택>>");

int bank = sc.nextInt();

 

 

switch (bank) {

case 1 -> {

System.out.print("예금>>");

int new_money = sc.nextInt();// 예금

 

total = new_money + total;

 

}

case 2 -> {

System.out.print("출금>>");

int mi_money = sc.nextInt();// 출금

System.out.print("출금액"+mi_money);

total = total - mi_money;

 

}

case 3 ->

 

{

System.out.println("잔고>>"+total);

}

 

case 4 ->

 

{

isStop = true;

 

}

 

 

 

default -> {

 

System.out.println("지원x");

}

 

}

 

}

 

sc.close();

System.out.println("종료");

 

}