아 왜 엔터 시발.. sc.nextLine() 여기저기 쑤셔줘봐도 안돼..도와주세요..ㅠㅠ
class Custom{
ArrayList<Bank> list = new ArrayList();
Scanner sc = new Scanner(System.in);
int indexNO = 0;
int menu() {
Scanner sc = new Scanner(System.in);
System.out.println("======BANK======");
System.out.println("* 1.추가"); // input
System.out.println("* 2.조회"); // show
System.out.println("* 3.입금"); // deposit
System.out.println("* 4.출금"); // withdraw
System.out.println("* 5.삭제"); // delete
System.out.println("* 9.종료"); // quite
System.out.print("입력>>> ");
int num = Integer.parseInt(sc.nextLine());
sc.nextLine();
System.out.println();
return num;
}
void input() {
System.out.println("사용할 ID 입력");
String tmpID = sc.nextLine();
System.out.println("사용할 PW 입력");
String tmpPW = sc.nextLine();
System.out.println("최초 예금액 입력");
int tmpBal = sc.nextInt();
list.add(new Bank(tmpID,tmpPW,tmpBal));
}
Boolean Autho(String tmpID, String tmpPW) {
Boolean autho = true;
for(int i = 0; i<list.size(); i++) {
if(list.get(i).equals(tmpID)) {
indexNO = i;
autho = true;
}else { autho = false;}
}
return autho;
}
void show() {
for(int i = 0 ; i<list.size();i++) {
System.out.println(list.get(i));
}
System.out.println("ID 입력");
String tmpID = sc.next();
System.out.println("PW 입력");
String tmpPW = sc.next();
if(Autho(tmpID,tmpPW)==true)
System.out.println(list.get(indexNO));
else System.out.println("ㅌ");
menu();
}
댓글 0