Skip to content

Commit 7fc49b3

Browse files
committedSep 19, 2018
Java Programming Example Chapter5
1 parent cf08533 commit 7fc49b3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed
 

‎Chapter5/Open_Challenge/src/ProductInfo.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ int getId(){
1515
void input(){
1616
Scanner sc = new Scanner(System.in);
1717
System.out.print("상품 설명>>");
18-
explanation=sc.next();
18+
explanation=sc.nextLine();
1919
System.out.print("생산자>>");
20-
producer=sc.next();
20+
producer=sc.nextLine();
2121
System.out.print("가격>>");
2222
price=sc.nextInt();
2323
}
@@ -37,12 +37,12 @@ class Book extends Product{
3737
void input(){
3838
super.input();
3939
Scanner sc = new Scanner(System.in);
40-
System.out.print("ISBN 번호>>");
41-
ISBNnum=sc.nextInt();
4240
System.out.print("책 제목>>");
43-
book_title=sc.next();
41+
book_title=sc.nextLine();
4442
System.out.print("저자>>");
45-
writer=sc.next();
43+
writer=sc.nextLine();
44+
System.out.print("ISBN 번호>>");
45+
ISBNnum=sc.nextInt();
4646
}
4747
void print(){
4848
super.print();
@@ -60,9 +60,9 @@ void input(){
6060
super.input();
6161
Scanner sc = new Scanner(System.in);
6262
System.out.print("앨범 제목>>");
63-
album_title=sc.next();
63+
album_title=sc.nextLine();
6464
System.out.print("가수>>");
65-
singer_name=sc.next();
65+
singer_name=sc.nextLine();
6666
}
6767
void print(){
6868
super.print();
@@ -91,7 +91,7 @@ public class ProductInfo {
9191

9292
static void productAdd(){
9393
Scanner sc = new Scanner(System.in);
94-
System.out.println("상품 종류 책(1), 음악CD(2), 회화책(3)>>");
94+
System.out.printf("상품 종류 책(1), 음악CD(2), 회화책(3)>>");
9595
Product p=null;
9696
int num=sc.nextInt();
9797

0 commit comments

Comments
 (0)
Please sign in to comment.