Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE HELP! Read instructions carefully please. I will thumbs up if someone can

ID: 3717612 • Letter: P

Question

PLEASE HELP! Read instructions carefully please. I will thumbs up if someone can correctly help me with this question. THANKS IN ADVANCE! :)

Q2: Function and operator overloading Book+ (20 points) In the given program (project 6), we can add books with same name and they can be in different or same library. In Main.cpp, write a function int totalBooks(string name) to search for book 'name' and display the sum of number of books named 'name'. 2.1 For adding the number of books, use operator+ overloading. You need to write 2 operator+ overloading functions of Book class: The first function takes in Book object as input parameter and returns sum of number of books of this' object and number of books of input object. The second operator+ overloading function takes an integer as input parameter and returns the sum of number of books of 'this' object and input integer. [5] 2.2 You need to define both the functions above but call any one of this operator+ overloading function in totalBooks(string name) to calculate and display total number of books of the given 'name' book. Define totalBooks(string name) [10] 3 | Page CSE220 Programming for Computer Engineering Project 07 2.3 Make a new option 't' in the menu to find total number of books of a book. In helper(), make an if-else case for option t' and call int totalBooks(string name) there. [5] Name: Intro to Java 5 books available in Noble library Published in 08/2805 Name: Comp Arch B books available in Noble library Published in jan2012 Book name: Comp Arch 3 books available in Hayden library Published in 85/2815 Please select one option: a: Add a new book to the database r: Remove a book from the database c: Change the available number of books t: Display total number of books of a book n: Display new books (published 2010 or later) d: Display all books in the database s: Sort the list of books in the database e: Exit and save the database in DB.txt Please enter the book's name : Comp Arch Total books = 11 8 + 3

Explanation / Answer

int totalBooks(string name) { Container *temp_list = list; int book_count = 0; Book b; while (temp_list != NULL) { if(book in temp_list equals name) { // Need the structure of container to do this b = book in temp_list; // Need the structure of container to do this book_count = b + book_count; // using operator overloading here } temp_list = temp_list->next; } return book_count; }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote