Computer Science: Where’s my Sherlock Holmes?

BY IN IB Computer Science Comments Off on Computer Science: Where’s my Sherlock Holmes?

Betty is a diligent librarian. In her spare time, she worked at a small library near her house. In the library, the book has stored in different containers. It has 5 containers at this moment and each container can hold maximum 3 books. The list of the books as follows (in sequential order from top to bottom)
-1st container:
Polly wants a cracker
The Stranger
In The Deep Blue Ocean
-2nd container:
The Secret of Monkey Island
-3rd container:
Le Chuck’s Revenge
The Quest of Rosetta
A Good Leader is A Good Servant
-4th container:
The Magical Season of Christmas
The Lost Necklace
The Bloody Hell Mary
-5th container:
Graduation Day
Sherlock Holmes

Then, here comes the problem. Betty just found out that she has put Sherlock Holmes book in wrong container. Instead of putting the book in the 5th container, she needs to remove it and put it in the bottom of 4th container, while she also need to remove The Lost Necklace in the bottom of 1st container, replacing The Stranger that supposed to be in the top of 2nd container. Remember the condition! She can only remove one book at one time, and the maximum capacity of each container is 3!

Create a program to simulate the process where Betty can put the book of Sherlock Holmes in the correct container! Draw an output clearly before and after the removal!




Comments are closed.