Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a wrapper class for a listing of Books. This wrapper class will maintain a list of all Books and will return which Book has

Write a wrapper class for a listing of Books. This wrapper class will maintain a list of all Books and will return which Book has the highest number of pages. A wrapper class is a class that acts as decoration for another class (in this case, class vector from the STL). Theres only one field to this class: Books: vector of type Book Your Books should have the following methods: addBook(Book): void // Adds a Book to the listing of Books getCount(): int // Returns the number of Books currently in this data structure getBookWithHighestPages(): Book // Returns the Book with the highest number of pages. If there is a tie among multiple Books, return the Book that was entered first. If the list is empty, throw an error. get(int i): Book // Returns the Book which is at position i. getNumberOfBooksHavePagesMoreThan(int): int // Counts and returns the number of Books in the data structure that have more pages that the passed parameter. Like the previous class file, this class should not read in any input or display any output. Create the Driver Application Create a driver application that demonstrates that each of the components of your program work. Create an empty Books structure with which to work. Create an interactive menu that gives the user the following choices and then performs that choice: Add Book. The program will prompt the user for a name, an author, a publish year, and a number of pages. The program will create that object and pass it to the data structure via a call to addBook. Get count. Prints to the screen the number of Books in the data structure. Get the Book with the highest number of pages. Prints to the screen the name, author, publish year and pages of the current Book with the highest number of pages in the data structure. Quit. Quits the application. Get number of Books have the number of pages more than N. Asks the user for an integer and then returns the number of Books have the number of pages more than that integer entered. (Entering a length of 0 should return the count of all Books.)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

b. Will there be one assigned leader?

Answered: 1 week ago

Question

d. How will lack of trust be handled?

Answered: 1 week ago

Question

b. Does senior management trust the team?

Answered: 1 week ago