Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, the whole problem does not need to be done. If I could at least get help on a few of the functions though that'd

image text in transcribedimage text in transcribed

Hello, the whole problem does not need to be done. If I could at least get help on a few of the functions though that'd be great.

Thank you

Implement a linked list data structure Apply the linked list data structure to book store application. roblem Statement: Wrte a program that maintains a list of books in stock for a bookstore. The program should repeatedly print a menu of options to allow a user to select from the following options, until the user decides to exit Insert a book record (Optionl) Delete a book record (Option2) Print the book list (Option3) Search the book list (Option4) . Each book record in the list consists of book title (string), number of copies in stock (int), and price (double). The book list should be maintained in the lexicographical order of the book titles Option1 (Insert): should read from user a book record (title, quantity, and price) and add the record into the list. (Add the new quantity to the old quantity and replace old price with new price only, if the book exists) Option 2 (Delete): asks for a book title and deletes the record that matches the title Option 3 (Print): lists all the books stored in the array in the lexicographical order of the book titles Option 4 (Search): allows a user to type a book title, then find search in the book list. If the matched book title has been found, displays the book record, otherwise, reports the book is not in the stock. To make it simple, for this program, assume the book title is case sensitive. (e.g., "computer networks and "Computer networks" are considered as two different books) Lexicographical ordering of Strings: when comparing two strings, you compare the first characters of each string, then second characters, and so on, until - One of the strings ends class Book public: string title; int quantity, double price Book* next class BookList public: // Constructor BookList ) / Destructor BookList () // Search for the book with the given title t / If the book is found, print its title, // quantity in stock and price: otherwise report // the book is not in the stock void search (string t) // Insert a new book record into the list. // The book has title t, number of copies in stock // is q, and price is p // Note that the vector of books should be maintained // in the lexicographical order of the book titles. / If the book title already exists in the list, // then upgrade the record with q and p void insert (string t, int q, double p) // Delete a book record, whose book title is t, / If the book is not in the list, do nothing void remove (string t) // Print the book records in the vector in the // lexicographical order of book titles void print) private: Book* first; Book* last: int count; // pointer to first node // pointer to last node / total number of books in stock

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

Real Time Database And Information Systems Research Advances

Authors: Azer Bestavros ,Victor Fay-Wolfe

1st Edition

1461377803, 978-1461377801

More Books

Students also viewed these Databases questions