import java.util.Scanner;
public class AccountTest
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
//계좌의 인스턴스 생성
Account account1 = new Account(50.12);
Account account2 = new Account(12.12);
Account account3 = new Account(-7.00);
Account account4 = new Account(25.00);
System.out.printf("accout1 balance : %.2f\n", account1.getBalance());
System.out.printf("accout2 balance : %.2f\n", account2.getBalance());
System.out.printf("accout3 balance : %.2f\n", account3.getBalance());
System.out.printf("accout4 balance : %.2f\n", account4.getBalance());
//계좌의 선택과 for문을 이용한 반복
do
{
System.out.print("계좌를 선택하시요(1, 2, 3, 4), exit=0 \n");
int num = input.nextInt();
//계좌 선택후 입금과 출금을 선택하는 메소드 호출
switch(num)
{
case 1: account1.option(); break;
case 2: account2.option(); break;
case 3: account3.option(); break;
case 4: account4.option(); break;
case 0: System.out.println("나가기를 눌렀습니다.");
break;
}
}while (num != 0);
}
}
나가기 버튼 즉 0번을 누르기 전까지 계속 무한반복을 돌릴려고 하는데 아예 반복문 알고리즘 자체가 잘못된건가요 행님들?? ㅠㅠ
에러는 계속 마지막 while에서 잘못되었다고 떠요 ㅠㅠ
scope 가 틀렸잖아. 그리고 맞춤법좀 신경써라. 시오 나 세요가 맞지 시요가 뭐임.
do while 의 while 은 do { } scope 의 밖이라, int num 이 do 이전에 선언되어 있어야함.