Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
은행 입출금
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_72 import java.util.*; import java.lang.*; class moneycol { int deposit, withdraw, balance; } class Rextester { private static Scanner scan; public static void main(String[] args) { moneycol m = new moneycol(); String input; scan = new Scanner(System.in); while (true) { System.out.print("1.입금 | 2.출금 | 3.잔고 | 4.종료:"); input=scan.next(); switch (input) { case "1": while (true) { System.out.print("입금액을 입력하세요:"); m.deposit = scan.nextInt(); if (m.deposit > 0) { System.out.println(m.deposit + "원 입금되었습니다."); m.balance += m.deposit; System.out.println("현재 잔액은" + m.balance + "입니다."); } else { System.out.println("입금액을 잘못 입력하였습니다."); System.out.println("현재 잔액은" + m.balance + "입니다."); continue; } break; } continue; case "2": while (m.balance > 0) { System.out.println("현재 잔액은" + m.balance + "입니다."); System.out.println("출금액을 입력하세요:"); m.withdraw = scan.nextInt(); if (m.balance > m.withdraw && m.withdraw > 0) { m.balance -= m.withdraw; System.out.println(m.withdraw + "원 출금되었습니다."); System.out.println("현재잔액은" + m.balance + "입니다."); } else { System.out.println("잘못입력했어요 다시 진행해주세요."); // System.out.println("현재 잔액은"+m.balance+"입니다."); break; } break; } if (m.balance == 0) { System.out.println("잔액이 없어 처음메뉴로 돌아갑니다."); } continue; case "3": System.out.println("현재 잔고는" + m.balance + "원 입니다"); continue; case "4": System.out.println("프로그램을 종료합니다."); System.out.println(""); break; default: System.out.print("잘못입력하여 처음메뉴로 돌아갑니다."); continue; } break; } } }
run
|
edit
|
history
|
help
0
3b
Find Median in Large File of Integers
bookstore (shopping,user,personal,borrowing)
Hi
[Java] Coding - Reverse CODE-String Method
Problem: rstring
Random number
2b
Main.java
Iterative Merge sort