Homework answers / question archive /
PROGRAMMING PROJECT #3: MANAGE THE LIBRARY Purpose:
Develop a program using the C++ class and inheritance
Solve problems using C++ Object Oriented Programming
Use arrays or vectors, strings, and files
Manipulate data using lists of objects
Description:
Write a program named “ManageTheLibrary” that accepts the library data file name as the command line argument:
>> ManageTheLibrary
Usage: ManageTheLibrary library-data-file-name
The format of the library file will be as follows:
Item type, item id, title and author or artist name
PROGRAMMING PROJECT #3: MANAGE THE LIBRARY Purpose:
Develop a program using the C++ class and inheritance
Solve problems using C++ Object Oriented Programming
Use arrays or vectors, strings, and files
Manipulate data using lists of objects
Description:
Write a program named “ManageTheLibrary” that accepts the library data file name as the command line argument:
>> ManageTheLibrary
Usage: ManageTheLibrary library-data-file-name
The format of the library file will be as follows:
Item type, item id, title and author or artist name
Computer Science
Share With
PROGRAMMING PROJECT #3: MANAGE THE LIBRARY Purpose:
- Develop a program using the C++ class and inheritance
- Solve problems using C++ Object Oriented Programming
- Use arrays or vectors, strings, and files
- Manipulate data using lists of objects
Description:
Write a program named “ManageTheLibrary” that accepts the library data file name as the command line argument:
>> ManageTheLibrary
Usage: ManageTheLibrary library-data-file-name
The format of the library file will be as follows:
Item type, item id, title and author or artist name.
Please note that the title and the author/artist fields are separated by the vertical bar.
Here is an example of the library data file:
// each line is a library item.
// type unique-id title | author-or-artist-name
BOOK 43045 Computer Science Hits | Neil Dale and John Lewis
BOOK 47341 How Computers Work | Ron White
BOOK 48450 Java: A Beginner's Guide | Herbert Schildt
CD 48452 Traveller | Chris Staphleton
CD 48453 How Can It Be Java | Lauren Daigle
BOOK 45552 Python Programming | John Zelle
CD 45553 I Still Do Programming | Eric Clapton
BOOK 45557 Beginning Software Engineering | Rod Stephens
CD 45561 Best Eagles Dictionary Songs | Eagles
CD 46555 The Ultimate Computer Hits | Garth Brooks
// the data file can contain comment lines or blank lines
The program will display a menu
Library:
- list all items (display all items in the library)
- list available items (display only available items in the library)
- list only books
- list only music CDs
- search (display all items, book or CD, that contains a given search string)
- check out (borrow an item given its unique id)
- return (return an item given its unique id)
- exit the program
Requirements:
-
- “LibraryItem” class is given and it cannot be modified.
- Define the LibraryItemBase class that inherits and implements the basic operations of the LibraryItem class
- You must declare at least two more classes that inherit the
LibraryItemBase and provides additional specific operations for that class: o Book o MusicCD
-
- In addition, you must define another class named “LibraryCatalog” that manages a list of LibraryItem objects (which includes both Book and MusicCD) using the Vector object. This class must refer only LibraryItem and must not make any reference to Book or MusicCD.
- Well structure, easy to understand with the proper use of reusable functions, methods and classes.
- Handle user errors with proper error messages
- Must produce similar information as provided in the sample output file.
- The book object should display as “AUTHOR: <author-name>” while the MusicCD displays as “ARTIST: <singer-name-or-band>”
- Initially, all items will have the same status: “STATUS: available”
- Once the item has been checked out, its status will be “STATUS: borrowed” and it cannot be checked out again
- If the Book or the MusicCD is returned, its status changes back to “STATUS: available”
- Search string will be over the title and the author/artist name and the result will include both Book and MusicCD
- The data file can contain a comment line that starts with “//” and it should be ignored.
- You should only have one list that contains both Book and MusicCD objects as they are LibraryItem objects (by inheritance).