import java.util.Scanner;
public class banking {
public static void main(String[] args) {
int balance = 10000;
int deposit;
int withdraw;
int customer;
System.out.println("===== 자바칩은행 =====");
do {
System.out.println("1.예금 | 2. 출금 | 3. 잔고확인 | 4. 종료");
Scanner sc = new Scanner(System.in);
customer = sc.nextInt();
switch (customer) {
case 1:
System.out.print("예금할 금액을 입력해주세요 >> ");
deposit = sc.nextInt();
balance += deposit;
System.out.println("현재 잔액은 " + balance + "원 입니다.");
break;
case 2:
System.out.print("출금할 금액을 입력해주세요 >> ");
withdraw = sc.nextInt();
if (balance < withdraw) {
System.out.println("잔고가 부족합니다.");
} else {
balance -= withdraw;
System.out.println("현재 잔액은 " + balance + "원 입니다.");
}
break;
default:
System.out.println("현재 잔액은 " + balance + "원 입니다.");
break;
}
} while (customer != 4);
System.out.println("서비스를 종료합니다.");
}
}