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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 12:00, clevelandjaniya1
Which of these is a benefit of using objects in a powerpoint presentation? a. collaborators can create the external files while you create and edit the slide show. b. you can easily change the theme and design of the presentation. c. you can have older data in the source file while having up-to-date data in the presentation. d. collaborators can easily share the presentation.
Answers: 2
image
Computers and Technology, 23.06.2019 15:00, Siris420
Plz ( which is an example of a good url?
Answers: 1
image
Computers and Technology, 24.06.2019 20:00, Cookie320
Write c++programs for the following problem: let the user enter two numbers and display which is greater. !
Answers: 1
image
Computers and Technology, 25.06.2019 06:10, gabbypittman20
In your pest busters game, how does player 2 move the ship_2 object? a pressing the w and s keys b. pressing the up arrow and down arrow keys c. moving the mouse from side to side d. moving the mouse up and down select the best answer from the choices provided
Answers: 3
You know the right answer?
Display the book with the longest title among the books whose bookType contain a specific substring....

Questions in other subjects:

Konu
Social Studies, 10.10.2019 16:40
Konu
Mathematics, 10.10.2019 16:40
Konu
Mathematics, 10.10.2019 16:40