瀏覽代碼

Implementation of BookFactory class

BookFactory is now implemented to handle all the books.
master
BinHong Lee 8 年之前
父節點
當前提交
960d43e6fd
共有 1 個檔案被更改,包括 25 行新增0 行删除
  1. +25
    -0
      BookFactory.java

+ 25
- 0
BookFactory.java 查看文件

@@ -0,0 +1,25 @@
import java.util.*;

class BookFactory
{
private List<Book> books = new ArrayList<Book>();
private int id;

public BookFactory()
{
id = 0;
}

public void newBook()
{
Book temp = new Book(id, "NOT AVAILABLE");
books.add(temp);

id++;
}

public Book getBook(int index)
{
return books.get(index);
}
}

Loading…
取消
儲存