You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

26 lines
340 B

  1. import java.util.*;
  2. class BookFactory
  3. {
  4. private List<Book> books = new ArrayList<Book>();
  5. private int id;
  6. public BookFactory()
  7. {
  8. id = 0;
  9. }
  10. public void newBook()
  11. {
  12. Book temp = new Book(id, "NOT AVAILABLE");
  13. books.add(temp);
  14. id++;
  15. }
  16. public Book getBook(int index)
  17. {
  18. return books.get(index);
  19. }
  20. }