-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPractice07.java
More file actions
73 lines (60 loc) · 1.45 KB
/
Practice07.java
File metadata and controls
73 lines (60 loc) · 1.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package chap04;
import java.util.Scanner;
public class Practice07 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner scan = new Scanner(System.in);
int total = 0;
boolean check = true;
while (check) {
System.out.println("--------------------------------");
System.out.println("1. 예금 | 2. 출금 | 3. 잔고 | 4. 종료");
System.out.println("--------------------------------");
System.out.print("선택>");
String choice = scan.nextLine();
switch (choice) {
case "1":
System.out.print("예금액>");
total = total + scan.nextInt();
break;
case "2":
System.out.print("출금액>");
total = total - scan.nextInt();
break;
case "3":
System.out.print("잔고>" + total);
break;
case "4":
System.out.print("프로그램 종료");
check = false;
break;
default:
break;
}
choice = scan.nextLine();
// System.out.print("선택>");
// int choice = scan.nextInt();
//
// switch (choice) {
// case 1:
// System.out.print("예금액>");
// total = total + scan.nextInt();
// break;
// case 2:
// System.out.print("출금액>");
// total = total - scan.nextInt();
// break;
// case 3:
// System.out.print("잔고>" + total);
// break;
// case 4:
// System.out.print("프로그램 종료");
// check = false;
// break;
// default:
// break;
// }
System.out.println();
}
}
}