Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 5: Queues Implement the following classes: 1. class Book that includes three instance variables: private int ISBN // Book ISBN private String title: //

image text in transcribed
Lab 5: Queues Implement the following classes: 1. class Book that includes three instance variables: private int ISBN // Book ISBN private String title: // Book tile private Book next: // link next Your class should have the following: A constructor that initializes the two instance variables ISBN and title. Set and get methods for each instance variable. 2. class BookQueue that includes two instance variables: private String filed private Book head, tail: Your class should have the following: 1. a constructor that initializes the filed instance variable. 2. public boolean enqueue (int isbn, String title) that creates and adds a Book if the passed isbn is not found in the queue. The Book must be added to the end of the queue. 3. private void enqueue (Book tamp) that inserts a Book object given as a parameter into the queue. 4. public Book dequeue () removes the first element from the queue, if the queue is not empty, and returns it to main; otherwise, return null. 5. public boolean search (int isbn) that checks whether the Book object with ISBN passed as a parameter is found in the queue or not. 6. public boolean updateTitle(int isbn, String newtitle) that updates a Book title if the ISBN is found in the queue and returns true, otherwise, retums false. 7. public void print() that prints the filed name and all the Books in the queue. 8. public int count() that returns the counts of Books in the queue. 3. class BookTest. In the main method, do the following: - Input the filed name then create an object of class BookQueue. - Display a menu to the user and asking for a choice to be entered. As follows: Choose: 1- enqueue a Book 2- dequeue a Book 3- Update a Book title 4- Count the Books 5- Print Book queue 6- exit Sample output Enter the filed name: Computer Engineering Choose: 1- enqueue a Book 2- dequeue a Book

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

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions

Question

2. To compare the costs of alternative training programs.

Answered: 1 week ago