4日目
This commit is contained in:
27
CUI_EM_OOP/src/Book.java
Normal file
27
CUI_EM_OOP/src/Book.java
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
public class Book {
|
||||
|
||||
String title;
|
||||
String author;
|
||||
int price;
|
||||
|
||||
public Book() {
|
||||
this.title = "タイトル未設定";
|
||||
this.author = "著者未設定";
|
||||
this.price = 0;
|
||||
|
||||
}
|
||||
public Book(String title, String author, int price) {
|
||||
this.title = title;
|
||||
this.author = author;
|
||||
this.price = price;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void output() {
|
||||
System.out.println(this.title);
|
||||
System.out.println(this.author);
|
||||
System.out.println(this.price);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user