#K92457. Library Management System
Library Management System
Library Management System
This problem requires you to implement a simple library management system which can store and retrieve information about books and journals. You are required to design three classes:
- Book: Stores a book's title, author, and ISBN.
- Journal: Inherits from Book and includes an additional field for the issue number.
- Library: Manages a collection of books and journals with the ability to add new entries and retrieve the list of stored information.
For a given sequence of commands issued through standard input, your program should update the library accordingly and output the complete list of book/journal information when requested. Note that titles and authors provided in the input may use underscores ('_') in place of spaces. Your program should replace these underscores with spaces in the output.
The format for the output of each book is given by the following formulas:
- Book: \(Title: {title}, Author: {author}, ISBN: {isbn}\)
- Journal: \(Title: {title}, Author: {author}, ISBN: {isbn}, Issue Number: {issue_number}\)
inputFormat
The input is provided through standard input. The first line contains an integer N, representing the number of commands. The following N lines each contain a command. There are three types of commands:
- ADD_BOOK title author isbn
- Add a book with the given title, author, and ISBN.
- ADD_JOURNAL title author isbn issue_number
- Add a journal with the given title, author, ISBN, and issue number (an integer).
- PRINT_LIBRARY
- Print the information of all books in the library in the order they were added. Note: Titles and authors may have underscores (_) instead of spaces.
outputFormat
For each PRINT_LIBRARY command, print the information of each book/journal stored in the library on a new line. The output for each item should follow the format:
- For a Book: "Title: {title}, Author: {author}, ISBN: {isbn}"
- For a Journal: "Title: {title}, Author: {author}, ISBN: {isbn}, Issue Number: {issue_number}"## sample
3
ADD_BOOK 1984 George_Orwell 1234567890
ADD_JOURNAL Science_Journal John_Doe 0987654321 42
PRINT_LIBRARY
Title: 1984, Author: George Orwell, ISBN: 1234567890
Title: Science Journal, Author: John Doe, ISBN: 0987654321, Issue Number: 42
</p>