[Solved]Librarytype Class Object Librarytype Class Contains Related Information Library Librarytyp Q37120246
The LibraryType Class
Each object of the LibraryType class contains the relatedinformation of a library. The LibraryType.h file is givento you. Carefully read the class definition inLibraryType.h. The
LibraryType class has two protected data members: a sorted linkedlist bookRecordList of BookRecord objects to store thebooks possessed by the library; a sorted linked listclientList of ClientType objects to store the clients ofthe library.
You are to implement and test the following operations for theLibraryType class. Detailed description andprecondition/postcondition for all the LibraryType’s memberfunctions are specified in the given header file.
- A default constructor.
- A parameterized constructor.
- Two set functions: setBookRecordList, setClientList.
- Two get functions: getBookRecordList, getClientList.
- An addBook function.
- An addClient function.
- A getBookRecord function.
- A getClient function.
- A borrowBook function.
- A returnBook function.
The LibraryType class is used to generate an engLib object whichrepresents the School of Engineering Library.
Here is the .h file
//**********************************************************
// SPECIFICATION FILE (LibraryType.h)
// This class specifies the basic members to implement a
// library.
//**********************************************************
#ifndef LIBRARYTYPE_H
#define LIBRARYTYPE_H
#include “SortedLinkedList.h”
#include “BookType.h”
#include “BookRecord.h”
#include “ClientType.h”
#include <iostream>
#include <string>
using namespace std;
class LibraryType
{
public:
// Constructor
LibraryType();
// Default constructor
// Post: bookRecordList is initialized to be an emptylinked list
// (by default). clientList is initialized to be anempty
// linked list (bydefault).
LibraryType(constSortedLinkedList<BookRecord>& bookRecords,
constSortedLinkedList<ClientType>& clients);
// Parameterized constructor
// Pre: bookRecords are ordered according to ISBN13.clients are ordered
// according to ID7.
// Post: bookRecordList is initialized to be a deepcopy of bookRecords.
// clientList is initialized to be a deep copy ofclients.
// Action responsibilities
void setBookRecordList(constSortedLinkedList<BookRecord>& bookRecords);
// Function to set the list of books currentlypossessed by the
// library.
// Post: bookRecordList = bookRecords (by deep copy using theoverloaded
// operator= in the LinkedListType class).
void setClientList(constSortedLinkedList<ClientType>& clients);
// Function to set the list of current clients of thelibrary.
// Post: clientList = clients (by deep copy using theoverloaded
// operator= in the LinkedListType class).
// Knowledge responsibilities
SortedLinkedList<BookRecord> getBookRecordList() const;
// Function to check the list of books currentlypossessed by the
// library.
// Post: A deep copy of bookRecordList is returned.
SortedLinkedList<ClientType> getClientList()const;
// Function to check the list of current clients ofthe library.
// Post: A deep copy of clientList is returned.
// Other functions
void addBook(const BookType& book, int num);
// Function to add books to the list of bookscurrently possessed by
// the library.
// Post: If book is not in the library book list yet(we determine this by
// comparing the ISBN13), then add num copies of bookto bookRecordList.
// If book is already in the library book list, thenincrease the
// corresponding book’s copiesTotal andcopiesAvailable by num
// simultaneously.
void addClient(const ClientType& client);
// Function to add a client to the list of currentclients of the library.
// Post: If client is not in the library client listyet (we determine this by
// comparing the ID7), then add client toclientList.
// If client is already in the library client list,then do not add the
// but simply display a message indicating that theclient is already in
// the library client list.
BookRecord getBookRecord(string ISBN13);
// Function to return a book record corresponding toan ISBN13.
// Post: If the corresponding book is in the librarybook record list, then
// return the corresponding book record. Otherwise,simply return
// a book record with ISBN13 and all other stringmembers containing “”
// (empty string) and display a related messageindicating that there
// is no such book in the library book recordlist.
ClientType getClient(string ID7);
// Function to return a client corresponding to anID7.
// Post: If the corresponding client is in the libraryclient list, then
// return the corresponding client. Otherwise, simplyreturn
// a client with ID7 and all other string memberscontaining “”
// (empty string) and display a related messageindicating that there
// is no such client in the library client list.
void borrowBook(string ISBN13, string ID7);
// Function to check out a book to a client. Thesystem mainly uses ISBN13
// to identify a book and ID7 to identify a client (asthese numbers are
// commonly obtained by scanning the barcode of thebook and the client’s ID.
// Post: If client is a library client, and the bookis in the library book
// list and available and the book is not in theclient’s bookList,
// insert a new node containing the book informationinto the client’s
// bookList, and then decrease copiesAvailable for thelibrary book
// record by 1.
// Otherwise, simply display a related message if theborrow action cannot
// be performed.
void returnBook(string ISBN13, string ID7);
// Function to check in a book. The system mainly usesISBN13 to identify
// a book and ID7 to identify a client (as thesenumbers are
// commonly obtained by scanning the barcode of thebook and the client’s ID.
// Post: If the client is a library client and thebook is in the client’s
// bookList, then remove the node containing the bookinformation from
// the client’s bookList and increase copiesAvailablefor the library
// book record by 1.
// Otherwise, simply display a related message if thereturn action cannot
// be performed.
protected:
SortedLinkedList<BookRecord> bookRecordList; //bookRecordList is a sorted
// linked list of the books currently possessed by thelibrary.
// The books are sorted in ascending order accordingto the
// default key member ISBN13.
SortedLinkedList<ClientType> clientList; //clientList is a sorted
// linked list of the current clients of thelibrary.
// The clients are sorted in ascending order accordingto the
// default key member ID7.
};
#endif
I need help creating the LibraryType.cpp file
Expert Answer
Answer to The LibraryType Class Each object of the LibraryType class contains the related information of a library. The LibraryTyp… . . .
OR

