Implementation This lab assignment will give you further opportunities to practice writing classes and using dynamic memory allocation. Your BookStore constructors and destructor will need to be modified so that there are no memory leaks or double frees. You need to change the class BookStore so the array of books is dynamically allocated at class construction time.
A new parameter will be added to the BookStore constructor to specify the number of elements of the array. Once the array is created, there is no provision in the design to resize it. The type of this array will now be Book** (dynamic array of pointers to Book). As before, the elements of this array will be dynamically al located when they are added to the array, and once the array fills up, no more books can be added.
An additional method will be added to the BookStore class to allow deletion of a book by position. Once again, the files you are going to need are bookstoremain.cpp contains your main function (modify it to allow remove book) book.h book.cpp bookstore.h bookstore.cpp contains the Book class declaration (leave as is) contains the Book class method definitions (leave as is) contains the BookStore class declaration (modify) contains the BookStore class method definitions (modify)
The following table explains each of the methods that you will need to implement Class Access Member Description Private Privateauthors Name of the book Array of string, names of the authors. Maximum Private Private Private quantity sbn authorCount ISBN of the book Number of authors actually in the Represents how many copies of this book are available Constructor takes in the ISBN, the name and Public Book( const string& isbn,quantity of the book const string& name, size t tit Public Book ( Constructor takes in the ISBN, the name, the const string&isbn,author (in case there is only one) and quantity of const string& name,the book const string& aut, size t Book tit Public PublicAddAuthor(const string&): Adds an author to the author array, only if it Book (const Book&) bool fits.
In case it does not fit in the array, it returns returns true otherwise Public ToString): string of the book Returns a Writes the book to the output stream in the parameter. It changes all spaces to to facilitate reading the file later Reads a book from an input stream, the fields are Write(ostreams): void Public Read (istream8): void ated However, the name of the
Reviews
There are no reviews yet.