Can you implement library.cpp using the member functions defined in library.h(dont change thisibrary especially for the array of pointers for books and borrowers. This is a resume of the meaning of the code.
This code is to be implemented in c++ code. I used visual studio.
Library Management System
The aim of this assignment is to design and implement a computerized Library Management System. The system will be used in the back-office to manage the books in the library catalog and to keep track of the various users (borrowers) of the library. Books are characterized by a call number, a title, and a flag that indicates whether the book is currently on-shelf (in the library) or on-loan. There are three types of borrowers: undergraduate students, graduate students and faculty members. All borrowers have an id, a name and are associated with a list of library books they have borrowed. Each borrower type has different borrowing privileges. Currently, undergraduate students may borrow a maximum of 10 books for a period of 4 weeks. Graduate students may borrow a maximum of 20 books for a period of 6 weeks, whereas faculty members may borrow a maximum of 30 books for a period of 8 weeks. Please comment so that I can put the code in the comments!! It is long and it doesn't let me to put it here.
this is the code if you comment I can send it to you so you can copy past it! it seems a lot but I only need help in the last part for a few functions you dont need to understand all the code only the basic rules of programming. please help thanks!
.'Il Koodo 18:10 18 % book ex.docx //book.h #pragma once #include
using namespace std:; class Book int bookNum; string title; bool available; public: Book0: Book int, string); Book(const Book&) Book0 int getBookNumberOconst string getBook TitleOconst; bool isAvailableOconst void setAvailability(bool); //Book.cpp #include "book.h" #include Book::Book0 bookNum 0; title ". Book::Book(int bookID, string titl) book Num title titl; bookID Book: Book(const Book&anotherbook) bookNum- anotherbook.bookNum; title anotherbook.title; Book Book0 int Book::getBookNumber)const return bookNum Koodo 18:10 18 % OK book ex.docx string Book:getBook TitleOconst bool Book: isAvailable)const return available; void Book::setAvailability(bool b) available b /Person.h class Person is an abstract class so print function pure destructor virtual-Person: using namespace std; Book books://list of books Person(int, string, int, int); Person(const Person&); void setduration(int); void borrowBook(Book&); void returnBook(Book&) Koodo 18:10 18 % OK book ex.docx bool searchBook(int)const; bool searchBook(string)const; virtual void print0 0; /Person.cpp #include #include "person-h #include using namespace std; Person::Person0 personID-0; name * books new Book10:create the arrays to use before we only had pointers!! limit -0; duration 0; Person::Person(int id, string n, int lim, int du) personlD id; books new Book[10]:/create the arrays to use before numBooks 0:dont need to put it in constructor limit- lim; we only had pointers!! parameters be 0 in the beggining!! duration du; Person::Person(const Person&anotherPerson) personID anotherPerson.personlD; name anotherPerson.name; new Book[10://create another array exact same!! num of books!! the array into the new array!! numBooks- anotherPerson.numBooks:/also copy the for (int i -0 numBooks i/copy each element of booksi]-anotherPerson.booksi] limit- anotherPerson.limit; .'Il Koodo 18:10 18 % OK book ex.docx Person-Persono deletellbooks int Person: :getlDOconst return personID; string Person::getName)const returm name: void Person:setlimit int lim) limit- lim; int Person::getlimit0 return limit; void Person:setduration(int du) duration du; int Person:getduration0 return duration; void Person::borrowBook(Book&b)/first check if it available then if limit if not exceeded// if (b.isAvailable0) if (numBooks 10) books[numBooks] b;// make the pointer points to next element to add one book!! b.setAvailability(false)://the book becomes unavailable//we can do b.setavailability because b is an object of class books that can access the member functions of its class. /setAvailability should be a cst function be b is a constant object but if set availability is cst it cant change Koodo 18:10 18 % OK book ex.docx the data member available else cout #include Koodo 18:11 18 % OK book ex.docx name):Person id,name, 10,4)// undergraduateStudent inherit from id and name from class Person //bc Person has only a constructor with 4 elements in it then put 4 here put 2 integers!!! /do nothing be no data members ohing void undergraduateStudent::print/the function print cant be const be of the function getName0??? cout #include using namespace std; graduateStudent:graduateStudent0 graduateStudent::graduateStudent int id, string name) Person(id, name, 10, 4/graduateStudent inherit from id and name from class Person //be Person has only a constructor with 4 elements in it then put 4 here put 2 integers!!! /do nothing be no data members graduateStudent:graduateStudent(const graduateStudent&) graduateStudent:: graduateStudent0 /ohing void graduateStudent:print/the function print cant be const bc of t he function getName0?7? cout include "person.h" #include "book.h" class Library private: string name; string address; Book books Koodo 18:11 18 % OK book ex.docx int numBooks; Person **borrowers; /bc Person is an abstract class we create pointers!!! int numBorrowers; public: LibraryO: Library(string, string); Library(const Library &) virtual LibraryO://bc this class has the Person abstract class in #include then the destructor of this class should be virtual /persons name+ID functions void addBorrower(Person):/people have ID but that doesnt mean they borrowed!! void removeBorrower(int id) void listAllBorrowersOconst; bool searchBorrower(int) //books functions// The class Person has those functions!! but here we are using pointers books not object so write again the functions!! void borrowBook(const Book):/bc Book *books is a pointer then (const Book*) void returnBook(Book b); void listAllBooksOconst; bool searchBook(int) const; bool searchBook(string)const; Mibrary.cpp #include" library,h" include #include using namespace std:; class Book int bookNum; string title; bool available; public: Book0: Book int, string); Book(const Book&) Book0 int getBookNumberOconst string getBook TitleOconst; bool isAvailableOconst void setAvailability(bool); //Book.cpp #include "book.h" #include Book::Book0 bookNum 0; title ". Book::Book(int bookID, string titl) book Num title titl; bookID Book: Book(const Book&anotherbook) bookNum- anotherbook.bookNum; title anotherbook.title; Book Book0 int Book::getBookNumber)const return bookNum Koodo 18:10 18 % OK book ex.docx string Book:getBook TitleOconst bool Book: isAvailable)const return available; void Book::setAvailability(bool b) available b /Person.h class Person is an abstract class so print function pure destructor virtual-Person: using namespace std; Book books://list of books Person(int, string, int, int); Person(const Person&); void setduration(int); void borrowBook(Book&); void returnBook(Book&) Koodo 18:10 18 % OK book ex.docx bool searchBook(int)const; bool searchBook(string)const; virtual void print0 0; /Person.cpp #include #include "person-h #include using namespace std; Person::Person0 personID-0; name * books new Book10:create the arrays to use before we only had pointers!! limit -0; duration 0; Person::Person(int id, string n, int lim, int du) personlD id; books new Book[10]:/create the arrays to use before numBooks 0:dont need to put it in constructor limit- lim; we only had pointers!! parameters be 0 in the beggining!! duration du; Person::Person(const Person&anotherPerson) personID anotherPerson.personlD; name anotherPerson.name; new Book[10://create another array exact same!! num of books!! the array into the new array!! numBooks- anotherPerson.numBooks:/also copy the for (int i -0 numBooks i/copy each element of booksi]-anotherPerson.booksi] limit- anotherPerson.limit; .'Il Koodo 18:10 18 % OK book ex.docx Person-Persono deletellbooks int Person: :getlDOconst return personID; string Person::getName)const returm name: void Person:setlimit int lim) limit- lim; int Person::getlimit0 return limit; void Person:setduration(int du) duration du; int Person:getduration0 return duration; void Person::borrowBook(Book&b)/first check if it available then if limit if not exceeded// if (b.isAvailable0) if (numBooks 10) books[numBooks] b;// make the pointer points to next element to add one book!! b.setAvailability(false)://the book becomes unavailable//we can do b.setavailability because b is an object of class books that can access the member functions of its class. /setAvailability should be a cst function be b is a constant object but if set availability is cst it cant change Koodo 18:10 18 % OK book ex.docx the data member available else cout #include Koodo 18:11 18 % OK book ex.docx name):Person id,name, 10,4)// undergraduateStudent inherit from id and name from class Person //bc Person has only a constructor with 4 elements in it then put 4 here put 2 integers!!! /do nothing be no data members ohing void undergraduateStudent::print/the function print cant be const be of the function getName0??? cout #include using namespace std; graduateStudent:graduateStudent0 graduateStudent::graduateStudent int id, string name) Person(id, name, 10, 4/graduateStudent inherit from id and name from class Person //be Person has only a constructor with 4 elements in it then put 4 here put 2 integers!!! /do nothing be no data members graduateStudent:graduateStudent(const graduateStudent&) graduateStudent:: graduateStudent0 /ohing void graduateStudent:print/the function print cant be const bc of t he function getName0?7? cout include "person.h" #include "book.h" class Library private: string name; string address; Book books Koodo 18:11 18 % OK book ex.docx int numBooks; Person **borrowers; /bc Person is an abstract class we create pointers!!! int numBorrowers; public: LibraryO: Library(string, string); Library(const Library &) virtual LibraryO://bc this class has the Person abstract class in #include then the destructor of this class should be virtual /persons name+ID functions void addBorrower(Person):/people have ID but that doesnt mean they borrowed!! void removeBorrower(int id) void listAllBorrowersOconst; bool searchBorrower(int) //books functions// The class Person has those functions!! but here we are using pointers books not object so write again the functions!! void borrowBook(const Book):/bc Book *books is a pointer then (const Book*) void returnBook(Book b); void listAllBooksOconst; bool searchBook(int) const; bool searchBook(string)const; Mibrary.cpp #include" library,h" include #include