The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 4 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
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
REF 48462 Encyclopedia Britannica | Britannica Inc.
REF 47344 National Geographic Computer | Lucy Spelman
BOOK 48450 Java: A Beginner's Guide | Herbert Schildt
CD 48452 Traveller | Chris Staphleton
CD 48453 How Can It Be Java | Lauren Daigle
REF 48460 The Merriam-Webster Dictionary | Merriam
BOOK 45552 Python Programming | John Zelle
CD 45553 I Still Do Programming | Eric Clapton
BOOK 45557 Beginning Software Engineering | Rod Stephens
REF 45559 A dictionary of nutrition | David Bender
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:
1. list all items (display all items in the library)
2. list available items (display only available items in the library)
3. list only reference items (display only RefBook items)
4. list only books (display only RefBook and Book items)
5. list only music CDs (display only MusicCD items)
6. search (display all items that match a given search string)
7. check out (borrow an item given its unique id)
8. return (return an item given its unique id)
9. 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 three more classes that inherit the LibraryItemBase and provides additional specific operations for that class:
o Book
o RefBook
o MusicCD
The “RefBook” class is like a “Book” class except that user cannot borrow and check out of the library.
In addition, you must define another class named “LibraryCatalog” that manages a list of LibraryItem objects (which includes Book, RefBook and MusicCD) using the Vector object. This class must refer only LibraryItem and must not make any reference to Book, RefBook or MusicCD.
Well structure, easy to understand with the proper use of reusable functions, methods and classes.
Handle user errors with proper error messages
#include
/**
* LibraryItem class provides basic operations for an item in a library
*/
class LibraryItem
{
public:
/**
* return the indicator on whether the item is currently borrowed or not
*/
virtual bool isOnLoan() = 0 ;
/**
* borrow the item.
* return true if the item can be borrowed and false otherwise.
*/
virtual bool borrow() = 0 ;
/**
* return the item.
* return true if the item can be returned and false otherwise.
*/
virtual bool takeBack() = 0 ;
/**
* return indicator whether a search string is found in this item
*/
virtual bool search(std::string searchStr) = 0 ;
/**
* return the library item's information a string
*/
virtual std::string toString() = 0 ;
} ;
-----------