Chakura is sitting at a table in a bookstore, attending her book signing. Customers are standing in line waiting for her to sign their copy of her book. However, it is possible that some customers in line may not have a book; they are in line simply to meet her. It’s also possible that some customers may have more than one book for her to sign. Write an appropriate algorithm using only the instructions listed in below.
accept the book from the customer
close the book
end repeat
end repeat
open the front cover of the book
place the book on the table repeat while (the customer has a book that needs signing)
repeat while (there are customers in line)
return the book to the customer
sign your name on the first page
thank the customer
Hi,
To implement this, we should know the basic functionality:
Here's what the algorigthm will look like:
So what we did is we repeated serving the customers and then
thanking them unless there are no customers remaining.
To serve a customer, we repeated signing all the books of a
customer.
To sign a book, we accept it, place it on the table, open front
page, sign, close the book and return it to the customer.
That's it. I hope this helps!
Get Answers For Free
Most questions answered within 1 hours.