From 960d43e6fdf6598225d2ff4e84c50fa6db47f9d2 Mon Sep 17 00:00:00 2001 From: BinHong Lee Date: Wed, 27 Apr 2016 16:22:44 -0700 Subject: [PATCH] Implementation of BookFactory class BookFactory is now implemented to handle all the books. --- BookFactory.java | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 BookFactory.java diff --git a/BookFactory.java b/BookFactory.java new file mode 100644 index 0000000..03671a4 --- /dev/null +++ b/BookFactory.java @@ -0,0 +1,25 @@ +import java.util.*; + +class BookFactory +{ + private List books = new ArrayList(); + 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); + } +}