CISC 3110 - Assignment #3 - Creating a Mini-Database

Emphasis on classes, objects, and arrays of objects.

Overview:

What is this assignment about? We would like to store information about library books. Then we will build a database for the library so that they can keep track of the books. As the semester progresses, we will add more features to this program.

Sketch of Program

  1. Create a class called book. Its member variables will store the attributes of any book.
  2. One of the things the book class will do is to make sure that the ISBN number of its book is valid. We already have code for this function... We can use it in this class!
  3. Composition: Create a libraryBook class. This class will store the attribues of a library book. A library book is simply a book with some additional information.
  4. Composition with array of objects: Create a library class that will store an array of libraryBooks. This database will be modifiable and searchable.

Programming Guidelines

Book Class

Attributes: Functions: the class should have accessors, mutators, and constructors. This class should not let the user assign an invalid ISBN number to a book. There should also be a display function that displays all information about a book.

Library Book Class

RECALL: A libraryBook includes everything that a book stores and can do.

Attributes: Functions: the class should have accessors, mutators, and constructors. There should also be a display function that displays all information about a library book. This function should call the display function that belongs to the book class.

Library Class

This abstract data type will store some information about the library (at least its name) and an array of LibraryBooks that the library owns. It will support the functionality needed by the menu-driven 'main' program described below.

User Interface

The program will use console input and output (cin and cout). The main function will display a menu, and read in user commands from the console. It will then call the appropriate function (of the Library class) to adjust the database accordingly. The menu should allow the following options:
  1. Add a book to the collection owned by the library. The user will be prompted for at least the book's title, author and ISBN number. Its initial status should be "available".
  2. Find a book at the library. The user should be able to search by author, title, or ISBN number (perhaps in a submenu). Once a book object is found in the array, all of its information should be displayed.
  3. Borrow a book from the library. Note: Borrowing a book involves first locating the book in the collection and then changing its status to borrowed. Reuse code: have one function call another!
    Make sure that only a book that is available is borrowable.
  4. Delete a book from those owned by the library. Be careful and make sure that book is completely removed yet the rest of the books remain intact.
  5. Print list of books owned by the library, one book per line. Include each book's basic information and its availability.
  6. Exit program.
There are different ways to store the collection of libraryBook. The simplest data structure is an array. However, it is of fixed size. For full credit, choose an implementation that allows the collection to keep growing (by adding more books).

Remember: An abstract data that that stores data should not perform I/O. All input and output should be in standalone functions, such as the 'main' function. For example, a function that displays information about a Book object should not be in the Book class. Similarly, the Book class should not have a function that directly asks the user for information.

Error Checking

Be sure to perform error checking whenever possible!

NOTE: In future assignments you will be modifying this code so it is important that you code in a way that will allow easy code reuse.