Question: Using C++ please implement those two classes and the main. Implementation This lab assignment will give you further opportunities to practice writing classes and using
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 allocated 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 book.h book.cpp bookstore.h bookstore.cpp contains your main function (modify it to allow remove book) 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 Member Access Private Private authors Description Name of the book Array of string, names of the authors. Maximum 3 authors ISBN of the book Number of authors Represents how many copies of this book are available Constructor takes in the ISBN, the name and isbn Private Private authorCount Private in the arra equantity PublicBook( const string& isbn,quantity of the book const string& name, size t tit PublicBook( Constructor takes in the ISBN, the name, the Book const string& isbn, author (in case there is only one) and quantity of const string& name, the book const string& aut, size t quantity Public PublicAddAuthor(const string8):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 false, returns true otherwise Public Tostring): string Public Write(ostream): void Returns a ation of the book 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 Public Rea(istream): void rated However, the name of the
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
