solution

Create a Book class with data members book title, author name, price, edition.
You are required to implement the following functions using the Last In First Out data structure.
Marks:7
• Constructor – for initializing the default values of a book
• setData( ) – for setting the data in the data members from the user
• isEmpty( ) – for checking whether stack of books is empty
• isFull( ) – for checking whether stack of books is full
• push( ) – for inserting a book in the stack. If the stack is full, you are required to ask the
user whether he/she wants to insert even if the stack is full. If the user says yes, then re-
size your stack to create a bigger stack. Also, check whether the book is already in the
stack or not. If the new book is already in the stack, display the user a message stating
the book is already in the stack.
• pop( ) – for removing a book from the stack
• reverseStack( ) – for reversing the order of the books in the stack. For example, if a
book with the title ABC was pushed at the last of the stack, then after calling this
function, the book ABC goes to 0th index i.e. it becomes 1st element that is entered.
• searchBook( ) – for a searching book by name or author. It asks the user to enter the
type of search he/she wants i.e. by Book name or by author name.
 
"Looking for a Similar Assignment? Get Expert Help at an Amazing Discount!"
Looking for a Similar Assignment? Our Experts can help. Use the coupon code SAVE30 to get your first order at 30% off!

Hi there! Click one of our representatives below and we will get back to you as soon as possible.

Chat with us on WhatsApp