Question 1: Write a program in C++ that implements a library management system. The program MUST use filing to manage library data. All the required methods must be implemented as member functions of the Book class. When program starts, it should display following menu and ask the user to make a choice: 1. Press 1 to add a new book in the library 2. Press 2 to display list of books available in the library 3. Press 3 to search a book by its name 4. Press 4 to delete a book by its ID 5. Press 5 to issue a book to the user 6. Press 6 to exit After user has made a choice, following actions must be performed: Case: User pressed 1 Record following details from the user and save in the file. If the file already exists then open the file for writing, otherwise create a new file. ● Book name ● Author name● Genre ● Number of pages ● Rating ● Language ● Issued to (User name) ● Issue date Case: User pressed 2 Open the file in input mode, read and display the details of all the books Case: User pressed 3 Ask the user to enter the name of a book. Open the file in read mode and search for the user-specified name in the file. If found, display the details of that book, otherwise display the message “Book not found” Case: User pressed 4 Ask the user to enter the ID of a book. Search that ID in the file and if found, delete that book from the file. Case: User pressed 5 Ask the user to enter the name of the book and his/her own name. Search the book from the file and save user name in the “Issue to” field and save the current date in “Issue date” field. Case: User pressed 6 Exit the program
Question 1:
Write a program in C++ that implements a library management system. The
program MUST use filing to manage library data. All the required methods must
be implemented as member functions of the Book class. When program starts, it
should display following menu and ask the user to make a choice:
1. Press 1 to add a new book in the library
2. Press 2 to display list of books available in the library
3. Press 3 to search a book by its name
4. Press 4 to delete a book by its ID
5. Press 5 to issue a book to the user
6. Press 6 to exit
After user has made a choice, following actions must be performed:
Case: User pressed 1
Record following details from the user and save in the file. If the file already exists
then open the file for writing, otherwise create a new file.
● Book name
● Author name● Genre
● Number of pages
● Rating
● Language
● Issued to (User name)
● Issue date
Case: User pressed 2
Open the file in input mode, read and display the details of all the books
Case: User pressed 3
Ask the user to enter the name of a book. Open the file in read mode and search for
the user-specified name in the file. If found, display the details of that book,
otherwise display the message “Book not found”
Case: User pressed 4
Ask the user to enter the ID of a book. Search that ID in the file and if found,
delete that book from the file.
Case: User pressed 5
Ask the user to enter the name of the book and his/her own name. Search the book
from the file and save user name in the “Issue to” field and save the current date in
“Issue date” field.
Case: User pressed 6
Exit the program
Step by step
Solved in 2 steps with 8 images