Question: A book managing program in C++. You are given a library and are to create a program with these options. 1. search the library of

A book managing program in C++. You are given a library and are to create a program with these options. 1. search the library of books by isbn 2. checkout a book 3. return a book 4. quit program

A book managing program in C++. You are given a library and

are to create a program with these options. 1. search the library

of books by isbn 2. checkout a book 3. return a book

4. quit program source code: To implement this program, we are going

source code:

to create a class called Book, which will allow us to create

objects that store the required information for a given book. Below is

To implement this program, we are going to create a class called Book, which will allow us to create objects that store the required information for a given book. Below is a UML diagram that describes what members the Book class should have: Book -title:string -author:string -ISBN:int -status:bool -checkedOutBy:string Book(p_title:string, p_author:string, p_ISBN:string) Getters and Setters +getTitle():string +getAuthor():string +getISBN():string +getStatus():bool +setTitle(new_title:string): none +setAuthor(new_author:string): none +setISBN(new ISBN:int): none Utility Methods +checkOutBook(name:string): bool +returnBook():void +outputBook():void Descriptions of Notable Methods 1. checkOutBook This method changes the status of the book to "true" and sets the "checkedOutBy" attribute to the name of the person that has checked out the book. This method should NOT update the status/checkedOutBy attributes if the book is already checked out. The method returns true if the book was successfully checked out and false if the book is already checked out. 2. returnBook - This method sets the status attribute to "false" and checkedoutBy attribute to the 2. returnBook -This method sets the status attribute to "false" and checkedOutBy attribute to the empty string (i.e., empty set of quotes). This method should return nothing. 3. outputBook - This method outputs the books information in the following format: by <author> ISBN: <isbn number> Checked out by: <whoever has it checked out> Note: If the book is NOT checked out, do NOT output the "Checked out by message. There is a partially completed definition of the main function, as well as functions for creating the book library (.e., an array of 5 book objects) and the ISBN lookup function. You goal for this file is to finish the definition of the main function by writing the code for each of the menu commands listed above. Below is a breakdown of how to write each command: Search the library of books by ISBN call the ISBN lookup function. If the function returns -1, then output an error message, otherwise, output the book at the returned index. Checkout a book. Call the ISBN lookup function. If the function returns -1, then output an error message. Otherwise, check to see if the book is currently checked out. If it is, output an appropriate error message. If not, then ask the user for the name of the person checking out the book and call the appropriate method for checking out the book. Note: Before inputting the string (which will require getline), use the statement "cin.ignore()" above the getline statement to ensure that your program doesn't "skip" the input for the name. Return a book. Call the ISBN lookup function. If the function returns -1, then output an error message. Otherwise, check to see if the book is currently checked out. If it is, call the appropriate method for checking out the book. If not, then output an appropriate error message. Quit Program. Cimnlturn to nuit the raram //Note: Change this name to reflect submission instrucions #include "Bookclass.h" using std::cin: using std::getline; void populateBookArray(Book Library()); int lookupByISBN (Book library 1): const int SIZE = 5 int main() //create an array of Book objects to store our library in. Book Library[SIZE]; //Populate our library with sample books. populateBookArray( library); NXX EX Complete the rest of main here. KN return 0; } 7/Note: This function assumes that there are 5 elements in this array. //Function populates our library with popular novels. //ISBN numbers are just random 5 digit numbers. // You can assume for the rest of your functions that the library //array is always 5 elements. void populateBookArray(Book Library()) { library[0].setAuthor("JK Rowling"); librarytoj.setTitle("Harry Potter and the Sorcerers Stone"); library[o].setISBN( 98346); library[1].setAuthor("C.S. Lewis"); library[1].setTitle('The Lion, the witch, and the Wardrobe"): library[1].setISBN ( 45336); library[2].setAuthor("E. 3. White"); library[2].setTitle("charlotte's Web"): library[2].setISBN(98346); library[3].setAuthor("F. Scott Fitzgerald"); library[3].setTitle("The Great Gasby": library[3].setISBN( 11934); Library[4].setAuthor("s. e. Hinton": Library[4].setTitle("The Outsiders"); library[4] .setISBN (72331), /Asks the user for the ISBN number of the book Vand searches the library for that book. /If found, returns the book element s index /if not found, returns -1. Ent lookupByISBN (Book Library[]) int ISBN; cout > ISBN; for (int i = 0; i </whoever></isbn></author>

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!