#C13509. Book Reading Tracker Simulation

    ID: 43055 Type: Default 1000ms 256MiB

Book Reading Tracker Simulation

Book Reading Tracker Simulation

This problem requires you to simulate a book reading tracker. The program will maintain a reading list of books, allowing users to add books, mark them as read, and view the current reading progress.

Functionality:

  • ADD: Adds a book to the reading list. The command will be provided in the format: ADD title,author,total_pages.
  • READ: Marks a specific book as read. It is invoked as: READ title. If the book exists, output a confirmation message. Otherwise, output an error message.
  • PROGRESS: Displays the reading progress. For each book in the order they were added, print a status line of the form: title by author - Read or title by author - Not Read. Finally, print a summary line in the format:
    Total Books: X, Books Read: Y, Percentage Read: Z, where \(Z = \frac{Y}{X} \times 100\) (if X > 0, otherwise 0).

You need to process commands from standard input and print the required output to standard output. All input commands are provided via stdin and output must be on stdout.

inputFormat

The first line contains an integer \(N\) representing the number of commands. The following \(N\) lines each contain one command. Each command is one of the following forms:

  • ADD title,author,total_pages
  • READ title
  • PROGRESS

Titles and author names may contain spaces. The total_pages is an integer.

outputFormat

For each command, the program might produce output:

  • For the READ command: output a message: if the book is found, print "Book '' marked as read."; otherwise, print "Book '' not found in the reading list." (without quotes).
  • For the PROGRESS command: output the status of each book (each on a new line) in the order they were added, followed by a summary line in the format "Total Books: X, Books Read: Y, Percentage Read: Z".
  • No output is produced for the ADD command.
## sample
3
ADD 1984,George Orwell,328
READ 1984
PROGRESS
Book '1984' marked as read.

1984 by George Orwell - Read Total Books: 1, Books Read: 1, Percentage Read: 100

</p>