-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMainProgram.java
More file actions
847 lines (729 loc) · 23.1 KB
/
MainProgram.java
File metadata and controls
847 lines (729 loc) · 23.1 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
import java.io.*;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Scanner;
import java.util.Vector;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
class MemoManager {//메모 관리 메뉴
static int countNumberOfMemo = 0;
static BufferedWriter bw;
static BufferedReader br;
static Vector<String> memoStorage;
static String memo;
public static void domanagememo() throws Exception {
memoStorage = new Vector<String>();
try {
while (true) {
bw = new BufferedWriter(new FileWriter("MemoManagerMYK.txt", true));
br = new BufferedReader(new FileReader("MemoManagerMYK.txt"));
String strLine;
System.out.println("\n===<Memo List>===");
countNumberOfMemo=0;
while((strLine = br.readLine())!= null) {
System.out.println((countNumberOfMemo+1)+": "+strLine);
countNumberOfMemo++;
}
if (countNumberOfMemo == 0) {
System.out.println("-저장된 메모 없음-");
}
if(br!=null) br.close();
System.out.println("=================");
System.out.println("==<메모 관리 메뉴>==");
System.out.println("1.메모 생성");
System.out.println("2.메모 업데이트");
System.out.println("3.메모 삭제");
System.out.println("4.뒤로가기");
System.out.println("==============");
System.out.print("입력: ");
Scanner sc = new Scanner(System.in);
int selection = sc.nextInt();
if (selection == 1) {
addmemo();
}
else if (selection == 2) {
updatememo();
}
else if (selection == 3) {
deletememo(br);
}
else if (selection == 4) {
System.out.println("메인화면으로 돌아갑니다.");
break;
}
else {
System.out.println("다시 입력하세요.");
}
}
}
catch (IOException e) {
e.printStackTrace();
}
}
public static void addmemo() throws IOException { // 메모 생성
System.out.println("추가할 메모내용을 입력하세요.");
System.out.print("입력: ");
Scanner sc1 = new Scanner(System.in);
memo = sc1.nextLine();
memoStorage.add(memo);
addStringMemo(bw, memo);
}
static BufferedWriter addStringMemo(BufferedWriter bw, String memo) {
try {
bw.write(memo);
bw.newLine();
bw.close();
}
catch (Exception e) {
e.printStackTrace();
}
return bw ;
}
public static void updatememo() { // 메모 업데이트
int number;
String dummy = "";
BufferedReader br1;
try {
br1 = new BufferedReader(new FileReader("MemoManagerMYK.txt"));
while (true) {
if (countNumberOfMemo == 0 ) {
System.out.println("저장된 메모가 없어 메모 수정 기능을 수행할 수 없습니다.\n메모관리 메뉴화면으로 돌아갑니다.");
break;
}
System.out.println("수정를 원하는 해당 메모의 번호를 입력하세요.");
Scanner sc3 = new Scanner(System.in);
number = sc3.nextInt();
if (countNumberOfMemo < number || number == 0) {
System.out.println("해당 메모가 없어 메모 수정 기능을 수행할 수 없습니다.\n메모관리 메뉴화면으로 돌아갑니다.");
break;
}
String line;
for (int i = 0; i<number-1; i++) {
line = br1.readLine();
dummy +=(line+"\r\n");
}
String updateData = br1.readLine();
System.out.println("수정을 원하는 메모: "+updateData);
System.out.println("원하는 내용으로 메모를 수정하세요.");
System.out.print("입력: ");
Scanner sc2_1 = new Scanner(System.in);
String updateMemo = sc2_1.nextLine();
dummy += updateMemo+"\r\n";
while((line = br1.readLine())!=null) {
dummy +=(line + "\r\n");
}
FileWriter fw = new FileWriter("MemoManagerMYK.txt");
fw.write(dummy);
fw.close();
br1.close();
System.out.println("해당 메모를 수정하였습니다.");
System.out.println("메모관리 메뉴화면으로 돌아갑니다.");
break;
}
}
catch (IOException e) {
e.printStackTrace();
}
}
public static String selectMemoLineTobeUpdated(BufferedReader br, int selectedLine) throws IOException {
for (int i = 0; i<selectedLine-1; i++) {
br.readLine();
}
String selData = br.readLine();
return selData;
}
public static String readAllMemo(BufferedReader br, int number, String updateMemo) throws IOException {
String dummies="";
String line;
for (int i = 0; i<number-1; i++) {
line = br.readLine();
dummies +=(line+"\r\n");
}
br.readLine();
dummies += updateMemo+"\r\n";
while((line = br.readLine())!=null) {
dummies +=(line + "\r\n");
}
return dummies;
}
static FileWriter UpdateStringMemo(FileWriter fw, String memo) {
try {
fw.write(memo);
fw.close();
}
catch (Exception e) {
e.printStackTrace();
}
return fw ;
}
public static void deletememo(BufferedReader br) throws Exception { // 메모 삭제
int number;
String YesOrNo;
String line;
br= new BufferedReader(new FileReader("MemoManagerMYK.txt"));
BufferedReader br1 = new BufferedReader(new FileReader("MemoManagerMYK.txt"));
BufferedReader br2;
try {
memoStorage.removeAllElements();
while((line = br1.readLine())!=null) {
memoStorage.add(line);
}
while (true) {
if (countNumberOfMemo == 0) {
System.out.println("저장된 메모가 없어 메모 삭제 기능을 수행할 수 없습니다.\n메모관리 메뉴화면으로 돌아갑니다.");
break;
}
System.out.println("삭제를 원하는 해당 메모의 번호를 입력하세요.");
Scanner sc3 = new Scanner(System.in);
number = sc3.nextInt();
if (countNumberOfMemo < number || number == 0) {
System.out.println("해당 메모가 없어 메모 삭제 기능을 수행할 수 없습니다.\n메모관리 메뉴화면으로 돌아갑니다.");
break;
}
String line2;
String dummy;
String deleteData="";
deleteData = selectMemoLineTobeDeleted(br, number);
System.out.println("삭제를 원하는 메모: "+deleteData);
while (true) {
System.out.print("정말 해당 메모를 삭제하시겠습니까?(Y/N): ");
Scanner sc4 = new Scanner(System.in);
YesOrNo = sc4.nextLine();
if (true == !(YesOrNo.equals("Y") || YesOrNo.equals("y") || YesOrNo.equals("N") || YesOrNo.equals("n")))
System.out.println("'Y' 또는'N'으로 제대로 다시 입력하세요.");
else
break;
}
if (YesOrNo.equals("Y") || YesOrNo.equals("y")) {
memoStorage.remove(number-1);
br2 = new BufferedReader(new FileReader("MemoManagerMYK.txt"));
String memoBunch="";
for (int i = 0; i<number-1; i++) {
line2 = br2.readLine();
memoBunch +=(line2+"\r\n");
}
deleteData = br2.readLine();
while((line2 = br2.readLine())!=null) {
memoBunch +=(line2 + "\r\n");
}
br2.close();
FileWriter fw = new FileWriter("MemoManagerMYK.txt");
fw.write(memoBunch);
fw.close();
System.out.println("해당 메모를 삭제하였습니다.");
System.out.println("메모관리 메뉴화면으로 돌아갑니다.");
}
else if (YesOrNo.equals("N") || YesOrNo.equals("n")) {
System.out.println("해당 메모를 삭제하지 않았습니다.");
System.out.println("메모관리 메뉴화면으로 돌아갑니다.");
break;
}
break;
}
}
catch (IOException e) {
e.printStackTrace();
}
}
public static String selectMemoLineTobeDeleted(BufferedReader br, int selectedLine) throws IOException {
for (int i = 0; i<selectedLine-1; i++) {
br.readLine();
}
String delData = br.readLine();
return delData;
}
}
class calculator{ // 계산기 메뉴
static Scanner scan = new Scanner (System.in);
calculator() {
int input;
do {
System.out.println("\n=<계산기 메뉴>=");
System.out.println(" 1.계산");
System.out.println(" 2.단위변환");
System.out.println(" 3.뒤로가기");
System.out.println("===========");
System.out.print("입력 : ");
input = scan.nextInt();
while(input>3||input<0) {
System.out.println("다시 입력하세요. : ");
input=scan.nextInt();
}
if(input==1)
calculate();
else if(input==2)
convert();
else {
System.out.println("메인화면으로 돌아갑니다.\n");
break;
}
}while(true);
}
public static void calculate() { // 계산
double num1,num2,result=0;
String operator;
String answer;
boolean run = true;
do {
System.out.print("\n숫자1 : ");
num1 = scan.nextDouble();
scan.nextLine();
System.out.print("숫자2 : ");
num2 = scan.nextDouble();
scan.nextLine();
System.out.print("연산자(+,-,*,/) : ");
operator=scan.nextLine();
if(operator.equals("+"))
result = Add(num1,num2);
else if(operator.equals("-"))
result = Sub(num1,num2);
else if(operator.equals("*"))
result = Mul(num1,num2);
else if(operator.equals("/"))
result = Div(num1,num2);
System.out.println("연산결과 : "+result);
System.out.print("다시 하시겠습니까? (Y/N) : ");
answer = scan.nextLine();
run = YesNo(answer);
}while(run);
}
public static double Add(double num1,double num2) {
return num1+num2;
}
public static double Sub(double num1,double num2) {
return num1-num2;
}
public static double Mul(double num1,double num2) {
return num1*num2;
}
public static double Div(double num1,double num2) {
return num1/num2;
}
public static void convert() { // 단위변환
int menu;
boolean run = true;
boolean run1=true;
double input;
double result;
String answer;
do {
run=true;
System.out.println("\n==<단위변환 메뉴>==");
System.out.println(" 1. pound->kg");
System.out.println(" 2. kg->pound");
System.out.println(" 3. inch->cm");
System.out.println(" 4. cm->inch");
System.out.println(" 5. °F->°C");
System.out.println(" 6. °C->°F");
System.out.println(" 7. 뒤로가기");
System.out.println("===============");
System.out.print("입력: ");
menu = scan.nextInt();
scan.nextLine();
while(menu>7||menu<1) {
System.out.print("다시 입력하세요. : ");
menu = scan.nextInt();
scan.nextLine();
}
switch(menu) {
case 1:
while(run) {
System.out.print("\n입력(pound) : ");
input = scan.nextDouble();
scan.nextLine();
result = pound2kg(input);
System.out.println("변환 결과(kg) : "+result);
System.out.print("다시 하시겠습니까? (Y/N) : ");
answer = scan.nextLine();
run = YesNo(answer);
}
break;
case 2:
while(run) {
System.out.print("\n입력(kg) : ");
input = scan.nextDouble();
scan.nextLine();
result = kg2pound(input);
System.out.println("변환 결과(pound) : "+result);
System.out.print("다시 하시겠습니까? (Y/N) : ");
answer = scan.nextLine();
run = YesNo(answer);
}
break;
case 3:
while(run) {
System.out.print("\n입력(inch) : ");
input = scan.nextDouble();
scan.nextLine();
result = inch2cm(input);
System.out.println("변환 결과(cm) : "+result);
System.out.print("다시 하시겠습니까? (Y/N) : ");
answer = scan.nextLine();
run = YesNo(answer);
}
break;
case 4:
while(run) {
System.out.print("\n입력(cm) : ");
input = scan.nextDouble();
scan.nextLine();
result = cm2inch(input);
System.out.println("변환 결과(inch) : "+result);
System.out.print("다시 하시겠습니까? (Y/N) : ");
answer = scan.nextLine();
run = YesNo(answer);
}
break;
case 5:
while(run) {
System.out.print("\n입력(°F) : ");
input = scan.nextDouble();
scan.nextLine();
result = Fahrenheit2Celsius(input);
System.out.println("변환 결과(°C) : "+result);
System.out.print("다시 하시겠습니까? (Y/N) : ");
answer = scan.nextLine();
run = YesNo(answer);
}
break;
case 6:
while(run) {
System.out.print("\n입력(°C) : ");
input = scan.nextDouble();
scan.nextLine();
result = Celsius2Fahrenheit(input);
System.out.println("변환 결과(°F) : "+result);
System.out.print("다시 하시겠습니까? (Y/N) : ");
answer = scan.nextLine();
run = YesNo(answer);
}
break;
case 7:
run1=false;
break;
}
}while(run1);
}
public static boolean YesNo(String answer) {
while(!(answer.equals("n")||answer.equals("N")||answer.equals("y")||answer.equals("Y"))) {
System.out.print("다시 입력하세요 : ");
answer = scan.nextLine();
}
if(answer.equals("n")||answer.equals("N"))
return false;
else
return true;
}
public static double pound2kg(double input) {
double result;
result = input*0.453592;
return result;
}
public static double kg2pound(double input) {
double result;
result = input*2.20462;
return result;
}
public static double inch2cm(double input) {
double result;
result = input*2.54;
return result;
}
public static double cm2inch(double input) {
double result;
result = input*0.393701;
return result;
}
public static double Fahrenheit2Celsius(double input) {
double result;
result = (input-32)/1.8;
return result;
}
public static double Celsius2Fahrenheit(double input) {
double result;
result = input*1.8+32;
return result;
}
}
class item implements Serializable{
int day;
String name;
int price;
public item(int day, String name, int price){
this.day = day;
this.name = name;
this.price = price;
}
public item() {}
public void setday(int day){
this.day = day;
}
public void setname(String name){
this.name = name;
}
public void setprice(int price){
this.price = price;
}
public int getday(){
return this.day;
}
public String getname(){
return this.name;
}
public int getprice(){
return this.price;
}
}
class Accountbook { // 가계부 관리 메뉴
public static int i=0;
public static void mainaccount()throws Exception{
Scanner scan = new Scanner(System.in);
Vector<item> v = new Vector<item>();
int number=1;
String string = "account.txt";
Object obj = null;
FileInputStream fis = null;
ObjectInputStream ois = null;
try
{
fis = new FileInputStream(string);
ois = new ObjectInputStream(fis);
while ((obj = ois.readObject()) != null)
{
v=(Vector<item>)obj;
}
fis.close();
ois.close();
}catch (ClassNotFoundException cnfe){}
catch (IOException e){}
while(number!=4){
System.out.println("========= <purchase list> ========");
System.out.println("번호\t구입날짜 \t상품명\t상품가격 ");
for(int i=0;i<v.size();i++){
System.out.printf("[%d]%10d%10s%10d\n"
,i+1,v.get(i).getday(),v.get(i).getname(),v.get(i).getprice());
}
System.out.println("==================================\n");
System.out.println("========== <가계부 관리 메뉴> ==========");
System.out.println("1. 가계부 작성\n2. 가계부 업데이트\n3. 구입 내역 삭제\n4. 뒤로가기");
System.out.println("==================================\n");
System.out.print("메뉴 번호 입력: ");
number = scan.nextInt();
switch(number){
case 1:
Accountbook.addaccount(v);
break;
case 2:
Accountbook.updateaccount(v);
break;
case 3:
Accountbook.deleteaccount(v);
break;
case 4:
return;//뒤로가기
default:
System.out.println("1-4 사이에서 입력해주세요");
break;
}
}
}
public static void deleteaccount(Vector<item> v) { // 구입 내역 삭제
Scanner scan = new Scanner(System.in);
String string = "account.txt";
FileOutputStream fos = null;
ObjectOutputStream oss = null;
try
{
if(new File(string).exists())
{
fos = new FileOutputStream(string, true);
oss = new MyObjectOutputStream(fos);
}else{
fos = new FileOutputStream(string, true);
oss = new ObjectOutputStream(fos);
}
if(v.size()==0){
System.out.println("삭제할 품목이 없습니다.");
return;
}
System.out.print("삭제할 구입내역의 번호를 입력하세요. ");
int num;
do{
num = scan.nextInt()-1;
if(num<0 || num >v.size()-1)
System.out.println("번호를 다시 입력하세요.");
}while(num<0 || num >v.size()-1);
v= delete(v,num);
oss.writeObject(v);
oss.flush();
oss.close();
fos.close();
}catch (FileNotFoundException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
}
}
public static Vector<item> delete(Vector<item> v,int num){
Scanner scan = new Scanner(System.in);
System.out.println("번호\t구입날짜 \t상품명\t상품가격 ");
System.out.printf("[%d]%10d%10s%10d\n"
,i+1,v.get(i).getday(),v.get(i).getname(),v.get(i).getprice());
System.out.println("정말 삭제하시겠습니까?(Y/N)");
String ans = scan.next();
while(true){
if(ans.equals("Y")||ans.equals("y")||ans.equals("N")||ans.equals("n")){
if(ans.equals("Y")||ans.equals("y")){
v.remove(num);
break;
}else if(ans.equals("N")||ans.equals("n"))
return v;
}
System.out.print("다시 입력하세요.(Y/N)");
ans = scan.next();
}
return v;
}
public static void updateaccount(Vector<item> v){ // 가계부 업데이트
Scanner scan = new Scanner(System.in);
String string = "account.txt";
FileOutputStream fos = null;
ObjectOutputStream oss = null;
try
{
if(new File(string).exists())
{
fos = new FileOutputStream(string, true);
oss = new MyObjectOutputStream(fos);
}else{
fos = new FileOutputStream(string, true);
oss = new ObjectOutputStream(fos);
}
if(v.size()==0){
System.out.println("수정할 품목이 없습니다. ");
return;
}
System.out.println("수정할 구입내역의 번호를 입력하세요. ");
int num;
do{
num = scan.nextInt()-1;
if(num<0 || num >v.size()-1)
System.out.println("번호를 다시 입력하세요.");
}while(num<0 || num >v.size()-1);
System.out.println("번호\t구입날짜 \t상품명\t상품가격 ");
System.out.printf("[%d]%10d%10s%10d\n"
,i+1,v.get(i).getday(),v.get(i).getname(),v.get(i).getprice());
System.out.println("수정할 항목의 번호를 입력하세요.");
System.out.println("1.구입날짜\n2.상품명\n3.상품가격");
int cas;
do{
cas=scan.nextInt();
v= update(v,num,cas);
}while(cas<1||cas>3);
oss.writeObject(v);
oss.flush();
oss.close();
fos.close();
} catch (FileNotFoundException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
}
return;
}
public static Vector<item> update(Vector<item> v,int num,int cas){
Scanner scan = new Scanner(System.in);
int day, price;
String name;
if(cas==1){
System.out.println("구입날짜:");
day = scan.nextInt();
v.get(num).setday(day);
}else if(cas==2){
System.out.println("상품명:");
name = scan.next();
v.get(num).setname(name);
}else if (cas==3){
System.out.println("상품가격:");
price = scan.nextInt();
v.get(num).setprice(price);
}else{
System.out.println("1번~3번 사이에서 입력해주세요.");
}
return v;
}
public static void addaccount(Vector<item> v) throws IOException{// 가계부 작성
Scanner scan = new Scanner(System.in);
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("account.txt"));
System.out.println("구입내역의 정보를 입력하세요. ");
int day, price;
String name;
System.out.print("구입날짜:" );
day = scan.nextInt();
System.out.print("상품명:" );
name = scan.next();
System.out.print("상품가격:" );
price = scan.nextInt();
v = adding(v,day,name,price);
oos.writeObject(v);
oos.close();
return;
}
public static Vector<item> adding(Vector<item> v,int day,String name,int price){
item i1 = new item(day,name,price);
v.add(i1);
return v;
}
}//AccountBook
class MyObjectOutputStream extends ObjectOutputStream
{
public MyObjectOutputStream(OutputStream out) throws IOException
{
super(out);
}
@Override
protected void writeStreamHeader() throws IOException
{
}
}
public class MainProgram { //메인 메뉴
@SuppressWarnings("unchecked")
public static void main(String[] args) throws Exception, ClassNotFoundException{
Scanner scan = new Scanner (System.in);
while (true) {
System.out.printf("========= MENU =========%n"
+ "1. Memo manager (메모관리)%n"
+ "2. Calculator (계산기)%n"
+ "3. Account book (가계부)%n"
+ "4. Exit (종료)%n"
+ "========================%n");
System.out.printf("메뉴 번호 입력: ");
int sel = scan.nextInt(); // 번호 입력
if (sel==1) {
MemoManager.domanagememo();
}// 메모관리 메뉴 호출
else if (sel==2){
new calculator();
}// 계산기 메뉴 호출
else if (sel==3){
Accountbook.mainaccount();
}// 가계부 메뉴 호출
else if (sel==4) { // 종료
break;
}
else {
System.out.println("다시 입력하세요. ");
}
}
}
}