Computer Science, asked by SoujiYarlagadda, 7 months ago

A scientist has created a Writing Bot which will read from one book and write into another. Both books may have different dimensions i.e. number of lines on each page and number of
pages itself. Reads and writes also happen at different speed.
The Bot first reads from the first book fully, then processes the format to write into the second book (done instantaneously) and finally starts writing into the second book.
Your task is to identify, after a specified interval of time, if the Bot is reading or writing. For each of these activities how much read and write activity has happened needs to be captured in
terms of number of pages and number of lines on the current page.​

Answers

Answered by ujdoshi
1

We need to bifurcate the answer in two parts. Determine whether reading is over or not.

if reading is incomplete in the time specified, use the data of book 1 else use data of book 2.

find total number of line that can be read or written in the time specified as per the case. use this and divide by number of lines per page to get the no. of pages red/written and use modulus to find the number of line being read/written.

Attachments:
Similar questions