Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ program Write a C++ program You have to implement a searchable textbook database. This will allow the user to search for the author (or

C++ program

image text in transcribed

Write a C++ program You have to implement a searchable textbook database. This will allow the user to search for the author (or ISBN or publisher, etc.) for a book with a particular title, as well as finding all books by a particular author, among other things. You will implement 2 classes: Book and BookDatabase The Book class must contain: A string for the title and publisher, an integer for the year of publication, and a vector (or list, or set) of strings for the author. (You can choose whichever one you want (You may write as many private functions as you would like to help your implementation.) Book(const string&title, const string&publisher, int yearOfPublication, string" authors, int numAuthors); This is the book constructor t l initialize all the member variables and al so store all of the authors names in the container that will hold these names bool operator (Book&bl, Book& b2); This will return true iff the two Books have the same title. (You can assume that the database will not contain 2 books with exactly the same title bool operator(Book&bl, Book& b2); WThis will return true iff the title of bookl is lexicographically before the title of book2. This will print a representation for a Book ostream& operator bookData For example for the Book object described above, the key would be "Data Structures with C++ Using STL" and the value would be the Book object containing that same string as a title, "Prentice Hall" as the publisher, 2002 as the year, andWilliam Topp", William Ford" However you want to represent this.) as the authors. Book& searchB yTitle(const string&title) /returns a reference to the Book object that contains the given title set-Booko searchBy Author(const string&author); Wreturns a set of Books by the given author. (This one is a bit tricky). set-Booko publishedBefore(int year); Wreturns a set of Books that were published before a given year set-Booko searchByPublisher(const string& publisher); Wreturns a set of Books that were published by the given publisher void addBook(Book&book);Wadds a new book to the database if it is not there already. (You will implement this by adding a new pair into the map where the key is book.getTitle0 and the value is book). If it is there already, do nothing. void removeBook(const string& title) /Remove the book with the given title from the database if it is there ostream& operator

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Database Programming

Authors: Chris Fehily

1st Edition

1937842312, 978-1937842314

More Books

Students also viewed these Databases questions