Fill This Form To Receive Instant Help
Homework answers / question archive / You will be building a linked list
You will be building a linked list. Make sure to keep track of both the head and tail nodes.
(1) Create five files to submit.
Build the BooklistNode class per the following specifications. Note: Some functions can initially be function stubs (empty functions), to be completed in later steps. All book names must be unique.
Ex. of PrintBooklistNode output string:
War and Peace
Author Name: Leo Tolstoy
Year Published: 1867
Build the BookList class per the following specifications. Note: Some functions can initially be function stubs (empty functions), to be completed in later steps.
(2) In main(), prompts the user for the title of the booklist.
Ex:
Enter booklist's title:
Favorites
and calls the PrintMenu() function. PrintMenu() takes the booklist title as a parameter and displays a menu of options to manipulate the booklist. Each option is represented by a single character. PrintMenu() calls the appropriate function in the BookList class, and outputs messages to the user.
If an invalid character is entered, continues to prompt for a valid choice.
Ex:
Favorites BOOKLIST MENU
a - Add book
d - Remove book
m - Move book to front
s - Output books by specific author
t - Output total number of books in booklist
o - Output full booklist
q - Quit
Choose an option:
(3) Implement the displayList function needed for the "Output full booklist" menu option. If the list is empty, outputs: Booklist is empty
Ex:
Favorites - OUTPUT FULL PLAYLIST
1.
War and Peace
Author Name: Leo Tolstoy
Year Published: 1867
2.
The Great Gatsby
Author Name: F. Scott Fitzgerald
Year Published: 1925
3.
Moby Dick
Author Name: Herman Melville
Year Published: 1851
4.
Anna Karenina
Author Name: Leo Tolstoy
Year Published: 1877
5.
The Curious Case of Benjamin Button
Author Name: F. Scott Fitzgerald
Year Published: 1922
(4) Implement the add function needed for the "Add book" menu item. New additions are added to the end of the list. If the book already exists, outputs "This book already exists" and is not added to the linked list
Ex:
ADD BOOK
Enter book's name:
Anna Karenina
Enter author's name:
Leo Tolstoy
Enter year published:
1877
(5) Implement remove for the "Remove book" function. Prompt the user for the name of the book to be removed. If the book is not in the list, outputs "(book name) not in list"
Ex:
REMOVE BOOK
Enter book's name:
The Great Gatsby
"The Great Gatsby" removed
(6) Implement moveFront for the "Move book to front" menu option. Prompt the user for the name of the book to be moved to the front. If the book is not in the list, outputs "(book name) not in list"
Ex:
MOVE BOOK TO BEGINNING
Enter book's name:
The Great Gatsby
"The Great Gatsby" moved to front of list
(7) Implement displayAuthor for the "Output books by specific author" menu option. Prompt the user for the author's name and output the node's information with this author's name, starting from the beginning of the list.
Ex:
OUTPUT BOOKS BY SPECIFIC AUTHOR
Enter author's name:
Leo Tolstoy
1.
War and Peace
Author Name: Leo Tolstoy
Year Published: 1867
2.
Anna Karenina
Author Name: Leo Tolstoy
Year Published: 1877
(8) Implement totalBooks for the "Output total number of books in booklist" menu option. Output the number of books in the booklist.
Ex:
OUTPUT TOTAL NUMBER OF BOOKS IN BOOKLIST
Total books: 5 books
Already member? Sign In