Question: Hello. please answer this following question will upvote. I only need number 2 but if you can please answer number 3 as well would be

Hello. please answer this following question will upvote.

I only need number 2 but if you can please answer number 3 as well would be very helpful.

Hello. please answer this following question will upvote. I only need number

/ Library.h

#ifndef LIBRARY_H

#define LIBRARY_H

#include "Book.h"

#define MAX_ARR_SIZE 128

class Library{

private:

Book books[MAX_ARR_SIZE];

int numOfBooks;

public:

Library();

void addBook(Book &);

void print();

};

#endif

//end of Library.h

// Library.cpp

#include "Library.h"

#include

#include

using namespace std;

Library::Library()

{

numOfBooks=0;

}

void Library::addBook(Book &book)

{

if(numOfBooks

{

books[numOfBooks] = book;

numOfBooks++;

}else

cout

}

void Library::print()

{

if(numOfBooks == 0)

cout

else

{

cout

for(int i=0;i

books[i].print();

}

}

//end of Library.cpp

1 12 2. Create a new Array class. You will need both a header file and a source file for this class. You can refe to the course material (section 2.1) and the coding examples done in class to see what belongs in the header file and what belongs in the source file. The class will contain two data members: .a data member called elements, which is an array of Book objects .a data member called size, which is the current number of books in the array Since the book array is moving from the Library class, you will also move the constant array size definition (MAX ARR_SIZE) into the correct location. 3. Write the following functions for the Array class: .a constructor that initializes the data member(s) that require initialization . an add (Book&) function that adds the given book parameter to the back of the book array .a print () function that prints out all the books in the array to the screen Note: These functions will be identical to the ones you wrote for the Library class in Tutorial #2. 4. Modify the Library class so that it does not manipulate the book array elements directly: remove the two data members that keep track of the books, and replace them with an Array object

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!