Question

Chakura is sitting at a table in a bookstore, attending her book signing. Customers are standing...

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

Homework Answers

Answer #1

Hi,

To implement this, we should know the basic functionality:

  • We will only continue as long as there are customers in the queue
  • once a customer arrives, note that he may have 0, 1, 2, or many books. So, we will repeat signing the books as long as the customer has a book to sign.
  • To sign a book, she need to accept the book, place the book on table, open front page, sign her name, close the book
  • Once all of the books belonging to a customer are returned to him , she thank the customer

Here's what the algorigthm will look like:

  1. Repeat while(there are customers in line):
    • Repeat while(the customer has a book that needs signing):
      • accept the book from the customer
      • place the book on the table
      • open front cover of the book
      • .sign your name on the front page
      • close the book
      • return the book to the customer
        end repeat
    • thank the customer
      end repeat

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!

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
Chick-fil-A is dominating the U.S. fast-food market. Whereas McDonald’s, Subway, Burger King, and Taco Bell trudge...
Chick-fil-A is dominating the U.S. fast-food market. Whereas McDonald’s, Subway, Burger King, and Taco Bell trudge along at the top of the heap, Chick-fil-A has quietly risen from a South- east regional favorite to become the largest chicken chain and the eighth-largest quick-service food purveyor in the country. The chain sells significantly more food per restaurant than any of its competitors—twice that of Taco Bell or Wendy’s and more than three times what the KFC Colonel fries up. And it...
The Business Case for Agility “The battle is not always to the strongest, nor the race...
The Business Case for Agility “The battle is not always to the strongest, nor the race to the swiftest, but that’s the way to bet ’em!”  —C. Morgan Cofer In This Chapter This chapter discusses the business case for Agility, presenting six benefits for teams and the enterprise. It also describes a financial model that shows why incremental development works. Takeaways Agility is not just about the team. There are product-management, project-management, and technical issues beyond the team’s control. Lean-Agile provides...
1. Summarize in a few sentences what Ayers found about pricing strategies in car markets. 2....
1. Summarize in a few sentences what Ayers found about pricing strategies in car markets. 2. Do you think that this is a profit maximizing strategy? Do you think this is an appropriate and reasonable strategy for businesses to undertake it it increases their profits? 3. Can you think of other goods or services that could be - or are - priced the same way? Check out the article on discrimination in coffee shops "Waiting for Good Joe" for some...
Muffler Magic* Muffler Magic is a fast-growing chain of 25 automobile service centers in Nevada. Originally...
Muffler Magic* Muffler Magic is a fast-growing chain of 25 automobile service centers in Nevada. Originally started 20 years ago as a muffler repair shop by Ronald Brown, the chain expanded rapidly to new locations, and as it did so Muffler Magic also expanded the services it provided, from muffler replacement to oil changes, brake jobs, and engine repair. Today, one can bring an automobile to a Muffler Magic shop for basically any type of service, from tires to mufflers...
Consumerization of Technology at IFG3 “There’s good news and bad news,” Josh Novak reported to the...
Consumerization of Technology at IFG3 “There’s good news and bad news,” Josh Novak reported to the assembled IT management team at their monthly status meeting. “The good news is that our social media traffic is up 3000% in the past two years. Our new interactive website, Facebook presence, and our U-Tube and couponing promotions have been highly successful in driving awareness of our ‘Nature’s Glow’ brand and are very popular with our target demographic—the under-30s. Unfortunately, the bad news is...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From...
Sign In INNOVATION Deep Change: How Operational Innovation Can Transform Your Company by Michael Hammer From the April 2004 Issue Save Share 8.95 In 1991, Progressive Insurance, an automobile insurer based in Mayfield Village, Ohio, had approximately $1.3 billion in sales. By 2002, that figure had grown to $9.5 billion. What fashionable strategies did Progressive employ to achieve sevenfold growth in just over a decade? Was it positioned in a high-growth industry? Hardly. Auto insurance is a mature, 100-year-old industry...
Please read the article and answear about questions. Determining the Value of the Business After you...
Please read the article and answear about questions. Determining the Value of the Business After you have completed a thorough and exacting investigation, you need to analyze all the infor- mation you have gathered. This is the time to consult with your business, financial, and legal advis- ers to arrive at an estimate of the value of the business. Outside advisers are impartial and are more likely to see the bad things about the business than are you. You should...
What tools could AA leaders have used to increase their awareness of internal and external issues?...
What tools could AA leaders have used to increase their awareness of internal and external issues? ???ALASKA AIRLINES: NAVIGATING CHANGE In the autumn of 2007, Alaska Airlines executives adjourned at the end of a long and stressful day in the midst of a multi-day strategic planning session. Most headed outside to relax, unwind and enjoy a bonfire on the shore of Semiahmoo Spit, outside the meeting venue in Blaine, a seaport town in northwest Washington state. Meanwhile, several members of...
      MK Restaurant: Branding of Thai-Style Hotpot The restaurant industry is one of the most...
      MK Restaurant: Branding of Thai-Style Hotpot The restaurant industry is one of the most competitive in Thailand. With a large number of players ranging from restaurants in five-star hotels, global fast-food chains to small stalls along the streets and everything in between, the Thais are spoiled for choice. In addition, as the world becomes globalized, consumers are familiar with international dishes and would not hesitate to try new offerings from the other side of the globe. As a...
In February 2012, the Pepsi Next product was launched into the US market. This case study...
In February 2012, the Pepsi Next product was launched into the US market. This case study provides students with an interesting insight into PepsiCo’s new product process and some of the challenging decisions that they faced along the way. Pepsi Next Case Study Introduction Pepsi Next was launched by PepsiCo into the US market in February 2012, and has since been rolled out to various international markets (for instance, it was launched in Australia in September 2012). The new product...