AP Computer Science – Quiz Involving Multiple Classes

 

This quiz will involve the writing of three classes to handle information about a book club. A book club will consist of people who each have their own library of books (their own private collection of books).

 

Classes you will write:

 

  1. A Book Class – maintains the following information about a book:

private String title; //Title of book

private String author; //Author of book

private int numPages; //Number of pages in book

  1. A BookLibrary Class – maintains the following information about a library of books:

private String owner; //Name of owner of the library

private int numBooks; //Number of books in the library

private ArrayList bookList<Book> (); //An ArrayList of Book objects (contains all books in the library)

  1. A BookClub Class – maintains the following information about a book club:

private ArrayList clubList<BookLibrary>(); //An ArrayList with a BookLibrary object for each member of the club

 

Here are the methods that you must write for each class (on your own paper):

 

Book Class

 

 

"The End of an Era" by Wendell Gilliam, 346 pages

 

 

BookLibrary Class

 

 

Books in library by Wendell Gilliam:

"The End of an Era"

"Farewell to Reality"

"When We Were Wild"

OR

none


 

Owner: Sarah Bellum

Books: 8

Book List

"The End of an Era" by Wendell Gilliam, 346 pages

"That Was All He Said" by Grace LeFleur, 278 pages

etc...

 

 

 

 

BookClub Class

 

 

Club members who own the book The End of an Era:

Wendy Stanfield

Brandy Weinstein

OR

Club members who own the book Oh So Sweet!:

none

 

 

Owner 1: Wendy Stanfield, Books: 9

Owner 2: Allan Benjamin, Books: 5

Owner 3: Brandy Weinstein, Books: 4

Owner 4: Juan Ramirez, Books: 6

 

Total Books in Club: 24

Unique Books in Club: 17