Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use c++ langauge 12 A Library contains a mimber of books, which can be added or removed Implement au Library with le following: 1. Three

Use c++ langauge image text in transcribed
image text in transcribed
image text in transcribed
12 A Library contains a mimber of books, which can be added or removed Implement au Library with le following: 1. Three private data member int massive that represents the maximum number of books that can be added to the library hint current that tracks the current number of book titles in the library, this tribute acts updated whenever a new book title is removed or added to the library string booklist, pointer to a dynamic array of strings that represent all the book titles in the bibrary 2. The following public member function Use this point in all member function of the dess that one or more parameters . Library into the size ton, allocate dynamic of size maxime, and make the booklist point points to the allocated Library : Delle list. supty(), badean fanction that comes in current and false other sull() hoolean function duti current size and tale otherwise int indoktring title) in the index of the book title ind in book wherwise string compare funcfr the thay void adding title) does the ralli title in the booklet the Library antitled wait the list Intities and in the the weather ftitie in the thesis Med Library() e com Library o FI a. Library(int n): that sets moxsize ton, allocates dynamic space of size maxsize, and make the booklist pointer points to the allocated space. b. Library(): Deallocates list. 6. isimpty().u boolean function that returns trae if current and false otherwise dispull(), a boolean function that returns true if current maxSize, and false otherwise int findBook(string title) returns the index of the book title if found in booklist, otherwise returns -1. HINT: use string compare function from the string library t. void addbook(String title) this function does the following: 1. add book title into the end of list booklist, if the Library is not full and title does not already exist in the list. 2. If title to be added is already in list, then print a message saying the title won't be added because it already exists in the library 3. Iftitle is not in list, but the list is full, then print a suitable message to say that the add book operation failed. 9. void printLibrary@ooks (): prints the book titles currently in the Library and their number h. Setter and getter for maxsize and gotter for current 1. float capacityUsage that calculates the percentage of maximum number of books filled with books//the division must be a floating point division 5. Define a global friend function void removeBook (Librarys libr, int 1) removes the item from the library booklist and shifts left remaining items that were to the right of the removed book-title, only if list is not empty and it is between 0 and current-1, inclusive AI cing. Question 2 (40 pts): Write a driver program to test the class you have implemented, where you will: 1. Create an array of string objects named myBooks_Items of size 6 and fill it with book- titles from the user 2. Create a Library object named lib with maxSize 8 and fill its first 5 items using the food items from my Books_items array. 3. Using a proper function call, remove the second item from bookList in lib. 4. Print the usage-percentage of the bookList in lib using a proper function call. 5. Using proper function calls, find if the last title in my Books_items array exists in lib and then remove it. 6. Using a prober function call, display the details of lib

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

Visual Basic 4 Ole Database And Controls Superbible

Authors: Michael Hatmaker, C. Woody Butler, Ibrahim Malluf, Bill Potter

1st Edition

1571690077, 978-1571690074

More Books

Students also viewed these Databases questions

Question

Design a job advertisement.

Answered: 1 week ago