subject

Display the book with the longest title among the books whose bookType contain a specific substring. Ask the user for a substring. This function is used to demonstrate garbage collection. bookType With SpecificString(): • This function displays a book with the longest title among the books whose bookType contain a specific substring. • You should find the book as follows: 1. By traversing all books, you should find the books whose bookType include a specific substring. 2. After step 1, you should find the book whose title is the longest. You may use 'titleLength' and 'index' variable. 3. After step 2, copy the details of the book to 'bookWithLengthyTitle' object created using 'new' and display the book's details using 'bookWith LengthyTitle' object. 'new // // This function displays an book with the longest name among the books whose bookType contain a specific substring. // You should find the book as follows: 1/ 1. By traversing all books, you should find the books whose booktype include a specific substring. // NOTE: you need to get a substring from user after printing a prompt. (Check the output in the pdf) // HINT: You may refer to the document of string:: find. // 2. After step 1, you should find the book whose title is the longest. You may use 'titleLength' and 'index' variable. // 3. After step 2, copy the details of the book to 'bookWithLengthyTitle' object created using 11 and display the book's details using 'bookWithLengthyTitle' object. // NOTE: You necessarily have to use the 'bookWithLengthyTitle' object to store the book details in it and delete it after displaying. You should not display book details using 'bll' object. // 4. Finally delete the 'bookWithLengthyTitle' object. void () { string subString: // Ask the user for a character Book* bookWithLengthy Title = new Book; int titleLength = 0; int index = -1; // enter code here } 4. Finally delete the bookWith LengthyTitle 'object. CSE240 HW8 Please select an action: a: add a new book d: display book list s: sort the books in descending order based on ID (within a range) n: display the book with the longest title among the books whose bookType contain a specific substring q: quit Enter the substring of book's bookType: Non Title: A Promised Land ID: 2 Aisle: 102 Book Type: Nonfiction n #include using namespace std; class Book { private: string title; int ID, aisle; string bookType; public: Book(); // constructor void setTitle(string title_input); void setID(int id_input); void setAisle(int aisle_input); void setBookType(string bookType_input); void displayBook(); string getTitle(); int getID(); int getAisle(); string getBookType(); #include "book. h" #include #include #define MAX_BOOKS 5 using namespace std; // forward declaration of functions (already implmented) void executeAction(char); 1/ functions that need implementation: // in book. cpp: // Q1 Book constructor // 2 points // Q2 Book member functions // 18 points // in this file (hw0891.cpp) : 03 to 26 int addBook (string title_input, int id_input, int aisle_input, string bookType_input); // 10 points void displayBooks(); // 5 points void sort(); // 10 points void (); 1/ 5 points Book b[MAX_BOOKS); int current Count = 0; // array of objects // number of books in the list int main() { char choice = 'i'; // initialized to a dummy value do { cout << "\nCSE240 HW8\n"; cout << "Please select an action:\n"; cout << "\t a: add a new book\n"; cout << "\t d: display book list\n"; cout << "\t s: sort the books in descending order based on ID (within a range)\n"; cout << "\t n: display the book with the longest title among the books whose bookType contain a specific substring\n"; cout << "\t q: quit\n"; cin >> choice; sin. ignore(); // ignores the trailing In executeAction(choice); } while (choice != ''); return 0; }

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 01:00
What is added to the < meta > tag to describe the encoding type?
Answers: 1
question
Computers and Technology, 22.06.2019 19:30
The following is an excerpt from a slide presentation. today we will inverse operations solving equations using inverse operations solving inequalities using inverse operations from which part of the presentation does the slide most likely come from? a. introduction b. outline c. body d. conclusion
Answers: 1
question
Computers and Technology, 22.06.2019 23:50
List a few alternative options and input and output over the standerd keyboard and monitor. explain their functioning in details.
Answers: 2
question
Computers and Technology, 23.06.2019 02:30
Three out of five seniors remain undecided about a college major at the end of their senior year.
Answers: 3
You know the right answer?
Display the book with the longest title among the books whose bookType contain a specific substring....
Questions
question
Mathematics, 14.02.2020 05:57
question
Mathematics, 14.02.2020 05:57
Questions on the website: 13722360