package chapter20230807;
import java.util.*;
public class test12 {
public static void main(String[] args) {
boolean run = true;
int balance = 0;
Scanner sc = new Scanner(System.in);
while (run) {
System.out.println("---------------------------------------");
System.out.println("1. 예금 | 2. 출금 | 3. 잔고 | 4. 종료");
System.out.println("---------------------------------------");
System.out.print("선택> ");
int menuNum = Integer.parseInt(sc.nextLine());
if(menuNum == 1) {
System.out.print("예금액> ");
int in = Integer.parseInt(sc.nextLine());
balance += in;
}
else if(menuNum == 2) {
System.out.print("출금액> ");
int out = Integer.parseInt(sc.nextLine());
balance -= out;
}
else if(menuNum == 3) {
System.out.println("잔액> " + balance);
}
else if(menuNum == 4) {
break;
}
}
System.out.println("프로그램 종료");
}
}