커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
1주차 숙제
Java 문법 종합반
1주차
북마크
박*승
댓글
2
추천
0
조회수
12
조회수
12
답변 완료



사진을 보시면 한 줄씩 밀려 입력 되었는데 선생님께서 남겨주신 정답코드를 입력해서 넣어 봐도 아래 캡처사진과 같이 똑같이나옵니다

그래서 저는 아래와 같은 값을 추가해서 넣었더니 정상으로 출력값이 나왔습니다.

제가 봤을 때 잘못쓴 코드는 없는것 같은데 아래 캡처사진과 같이 나온 이유가 뭘까요..? ㅠ

 String recipe = sc.nextLine();




스파르타 즉문즉답




작성한 코드 및 에러 메세지

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String cook = sc.nextLine();
        double cookStar = sc.nextDouble();


        String recipe1 = sc.nextLine();
        String recipe2 = sc.nextLine();
        String recipe3 = sc.nextLine();
        String recipe4 = sc.nextLine();
        String recipe5 = sc.nextLine();
        String recipe6 = sc.nextLine();
        String recipe7 = sc.nextLine();
        String recipe8 = sc.nextLine();
        String recipe9 = sc.nextLine();
        String recipe10 = sc.nextLine();

        System.out.println("["+ cook + "]");
        double cookPersent = ((int)cookStar * 100) / 5 ;
        System.out.println("별점:" + (int)cookStar + "(" + cookPersent + "%)");

        System.out.println("1." + recipe1);
        System.out.println("2." + recipe2);
        System.out.println("3." + recipe3);
        System.out.println("4." + recipe4);
        System.out.println("5." + recipe5);
        System.out.println("6." + recipe6);
        System.out.println("7." + recipe7);
        System.out.println("8." + recipe8);
        System.out.println("9." + recipe9);
        System.out.println("10." + recipe10);




    }

}




취소
 공유
취소
댓글 0
댓글 알림
나의얼굴