Creating the library management system

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 2PE
icon
Related questions
Question

In Java

. Creating the library management system
1. Create a class called LibraryManagement System with the following attributes/variables:
a. Node headNode-Contains the reference/pointer of the first Node object
Create the following methods in the LibraryManagement System class:
1. Implement a function insertBook(Book new Book) to add a book at the end of the
linked list.
a. Ask the librarian to input all the necessary book information.
b. Use the information to create a Book object
c. Pass through the Book object as the parameter to the function
d. Store the Book object into the Node object
e. "Link" the object with the rest of the linked list
2. Implement a function insertBefore(Book new Book, int bookID) to add a book in
front of another book given its bookID.
a. Ask the librarian to input all the necessary book information.
b. Use the information to create a Book object
c. Pass through the Book object and bookID as the parameter to the function
d. Search for the matching Book object
e Store the Book object into the Node object
f. "Link" the object with the rest of the linked list
3. Implement a function searchBook(int bookID) to search for a book by its bookID
code and return the book object.
a. Ask the librarian to input the bookID.
b. If the book doesn't exist display an appropriate message.
SAG
FROM HOPE TO ACTION THROUGH KNOWLEDGE.
Implement a function deleteBook(int bookID) to delete a book from the linked list by
UNIVERSITY bookID code.
WESTERN CAPE
a. If the book doesn't exist, please display an appropriate message.
5. Implement a function list AllBooks() to display all the books in the linked list.
a. If there are no books, please display an appropriate message
6. Implement a function sortLibrary() to sort all the books in the linked list by its bookID
code ascendingly.
7. Implement a function totalBooks() to count the total amount of books in the linked list
and return it.
Transcribed Image Text:. Creating the library management system 1. Create a class called LibraryManagement System with the following attributes/variables: a. Node headNode-Contains the reference/pointer of the first Node object Create the following methods in the LibraryManagement System class: 1. Implement a function insertBook(Book new Book) to add a book at the end of the linked list. a. Ask the librarian to input all the necessary book information. b. Use the information to create a Book object c. Pass through the Book object as the parameter to the function d. Store the Book object into the Node object e. "Link" the object with the rest of the linked list 2. Implement a function insertBefore(Book new Book, int bookID) to add a book in front of another book given its bookID. a. Ask the librarian to input all the necessary book information. b. Use the information to create a Book object c. Pass through the Book object and bookID as the parameter to the function d. Search for the matching Book object e Store the Book object into the Node object f. "Link" the object with the rest of the linked list 3. Implement a function searchBook(int bookID) to search for a book by its bookID code and return the book object. a. Ask the librarian to input the bookID. b. If the book doesn't exist display an appropriate message. SAG FROM HOPE TO ACTION THROUGH KNOWLEDGE. Implement a function deleteBook(int bookID) to delete a book from the linked list by UNIVERSITY bookID code. WESTERN CAPE a. If the book doesn't exist, please display an appropriate message. 5. Implement a function list AllBooks() to display all the books in the linked list. a. If there are no books, please display an appropriate message 6. Implement a function sortLibrary() to sort all the books in the linked list by its bookID code ascendingly. 7. Implement a function totalBooks() to count the total amount of books in the linked list and return it.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

the answer dose not include the main method.

Write a main method inside the LibraryManagementSystem class, create a menu system that allows the Librarian input commands to interact with the system. Below is the menu system that students should aim to recreate. Give an appropriate message after each action to notify the Librarian if an action was successful. Make use of the toString() to print the Book objects.

 

Sample Input:
Welcome to the new Library Management System.
1. Add book
2. Add book before a specific book ID
3. Search book by book ID
4. Delete book by book ID
5. List all books
6. Sort library by book ID
7. Count total books
0. Exit
Enter your choice:
Transcribed Image Text:Sample Input: Welcome to the new Library Management System. 1. Add book 2. Add book before a specific book ID 3. Search book by book ID 4. Delete book by book ID 5. List all books 6. Sort library by book ID 7. Count total books 0. Exit Enter your choice:
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Structured English
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning