Write a program that maintains a list of books

Assignment Help Data Structure & Algorithms
Reference no: EM133664862

Library Inventory Database

Write a program that maintains a list of books for a library. The program must accept commands to make insertions and deletions in this list, while simultaneously maintaining the list in alphabetical order for three string type keys: Subject, Author, and Title.

Input

1. The book information created in previous executions of this program, if any, is stored in the text file "books.txt". Each book's information is on three consecutive lines. The format of each line is described in the table below:

2. The program inputs commands from the user (keyboard) to insert, delete, list by key, and quit. You are free to implement the "user interface" part of the program as you wish, as long as it is easy to use.

Output

1. The results of each operation should be written to the screen. In addition, transaction information describing the processing of each command should be written to an output file. (For instance, for an Insert command, the output file should contain the title, author, and subject information, as well as the location where the record was inserted and the location of its entry in each ordering array.) The information in the output file should be neatly formatted and clearly labeled.

2. The "books.txt" text file should be rewritten to contain the updated book information. Data Structures

The records containing information about each book (subject, author, and title strings) must be stored in an array. These records may be stored in consecutive array slots in the order in which they are inserted. For example, if the book information is stored in an array called bookData, bookData[0] contains information about the first book inserted, bookData[1] contains information about the second book inserted and so on.

The list must be maintained in order by title, in order by author, and in order by subject by using arrays of pointers (indexes), one for each key. For instance, suppose the key order information is stored in arrays of KeyOrderType, as described below:
typddef int[MAX_BOOKS] KeyOrderType; titleOrder : KeyOrderType;
authorOrder : KeyOrderType;
subjectOrder : KeyOrderType;

The zeroth array slot contains the index of the first book record with the appropriate key. For example, titleOrder[0] indicates the index of the book that comes first alphabetically by title. If titleOrder[0] = 5, then bookData[5] contains the first alphabetical title. The next book, in alphabetical order by title, would be found in the bookData array at the index indicated by titleOrder[1]. For index >= 0, titleOrder[index]contains the index in bookData of the next title in the alphabetic ordering. The authorOrder and subjectOrder arrays work similarly. (The arrays may be bound together in a struct, if you wish. They are described here as separate entities only for clarity.)
You must use the data structure code from the book for your sorted list and unsorted list.

Do not use anything that would require you to include the libraries algorithm.h or vector.h or similar. If you have any questions about this, let me know before submitting the assignment.

Commands
The program must be able to process the following commands:

Command

Processing

INSERT

Prompt the user for the author, title, and subject. Add entry for this book in the next available location in the bookData array, then update the titleOrder, authorOrder, and subjectOrder arrays. Print a message to the screen and write transaction information to the output file. If the bookData array is full, print an error message and abort the insertion, leaving all of the arrays unchanged.

DELETE

Prompt the user for the name of the book to delete. (You can assume that this is a unique key.) Search for the title to be deleted. If it is found, all the ordering arrays must be updated. Print a message to the screen and write transaction information to the output file. If the book is not found, leave the list and ordering arrays unchanged, and print an error message.

LIST

Prompt the user to specify which key to use for ordering the output. Print out the information about each book, in the indicated order, to the screen and to the transaction file. Format this information clearly. If the list is empty, print an appropriate message.

QUIT

Prompt the user to verify that he or she wants to quit; if so, save the book information to file "books.txt" and terminate the program.

Command Processing

INSERT Prompt the user for the author, title, and subject. Add entry for this book in the next available location in the bookData array, then update the titleOrder, authorOrder, and subjectOrder arrays. Print a message to the screen and write transaction information to the output file. If the bookData array is full, print an error message and abort the insertion, leaving all of the arrays unchanged.

DELETE Prompt the user for the name of the book to delete. (You can assume that this is a unique key.) Search for the title to be deleted. If it is found, all the ordering arrays must be updated. Print a message to the screen and write transaction information to the output file. If the book is not found, leave the list and ordering arrays unchanged, and print an error message.

LIST Prompt the user to specify which key to use for ordering the output. Print out the information about each book, in the indicated order, to the screen and to the transaction file. Format this information clearly. If the list is empty, print an appropriate message.

QUIT Prompt the user to verify that he or she wants to quit; if so, save the book information to file "books.txt" and terminate the program.

Deliverables
• Source code files (cop and .h)
• Your test inventory file (books.txt)

Remember that your code must be appropriately commented. You must use inline comments and block comments. (Your class member function comment blocks should be above your function declarations in your header file.)

Reference no: EM133664862

Questions Cloud

Performing admission assessment : The nurse is performing an admission assessment on a 90 year old patient and notes confusion with poor orientation to person, place, and time.
What step do you think appreciative inquiry consultant taken : What do you think went wrong? What steps do you think the Appreciative Inquiry consultant could have taken to make the consulting process go better?
Development of your professional nursing identity : Why are these actions important to the development of your professional nursing identity?
Explain how hr measures can improve talent-related decisions : Explain how HR measures can improve talent-related decisions in organizations. Discuss how the company in case aligned people analytics with company objectives.
Write a program that maintains a list of books : Write a program that maintains a list of books for a library. The program must accept commands to make insertions and deletions in this list
Patient experiencing daytime sleepiness and fatigue : Who reports that for several months, they have noticed the patient experiencing daytime sleepiness and fatigue.
Emergency department for chronic nausea : Your 95-year-old primary care patient was seen in the emergency department (ED) for chronic nausea 4 months ago
History of systemic sclerosis : A middle-aged female patient with a history of systemic sclerosis presents to her cardiologist's office with complaints of increasing fatigue,
Write a brief medical history for the patient : Write a brief medical history for the patient. Describe two lab procedures: Manual Hemoglobin and Spun Hematocrit.

Reviews

len3664862

3/25/2024 11:20:31 PM

Hello, could you write this in Microsoft Visual Studio? I will send the template for the sorted list in another message. Thank you.

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd