#K35747. Library Book Management System

    ID: 25600 Type: Default 1000ms 256MiB

Library Book Management System

Library Book Management System

You are required to implement a Book class for a library management system. The Book class should have the following properties and methods:

Properties:

  • title: A string representing the title of the book.
  • author: A string representing the author of the book.
  • isbn: A string representing the International Standard Book Number.
  • availability: A boolean indicating whether the book is available for loan. This should be initialized to (true).

Methods:

  • loan(): Sets the availability to (false).

  • return_book(): Sets the availability to (true).

  • display_info(): Prints the details of the book in the following format:

    Title: <title>\n      Author: <author>\n      ISBN: <isbn>\n      Available: <availability>\n
    

The main program should read from standard input (stdin) and write to standard output (stdout). The input format is described below.

inputFormat

The input consists of multiple lines:

  1. The first line contains the title of the book.
  2. The second line contains the author of the book.
  3. The third line contains the ISBN of the book.
  4. The fourth line contains an integer (N) representing the number of commands.
  5. The next (N) lines each contain a command which will be one of the following:
    • "loan" to loan the book.
    • "return" to return the book.
    • "display" to print the book details.

outputFormat

Whenever the command "display" is encountered, output the book details on four separate lines in the following format: Title: Author: ISBN: Available:

Note: The availability should be printed as "True" if the book is available and "False" if it is not.## sample

1984
George Orwell
978-0451524935
1
display
Title: 1984

Author: George Orwell ISBN: 978-0451524935 Available: True

</p>