Skip to content

Instantly share code, notes, and snippets.

@keithtom
Last active December 14, 2015 22:19
Show Gist options
  • Save keithtom/5157468 to your computer and use it in GitHub Desktop.
Save keithtom/5157468 to your computer and use it in GitHub Desktop.

Exercise: The Restaurant Wait Time

We have been contracted to write a piece of software for a restaurant. They want to easily be able to enter orders that come in, and be told how long the wait time will be for that order. That is, we are going to write a simple program for placing an order at a restaurant and it will print to the screen how long the wait is.

You can order the following items:

  • pizza
  • spaghetti
  • lasagna
  • salad

Each item takes a certain amount of time to prepare. A pizza takes 15 minutes, spaghetti 12 minutes, lasagna 30 minutes and a salad only 5 minutes.

You need to keep in mind that as items keep getting ordered, the wait will be longer and longer. For example, if there are two pizzas ordered, the wait will be 30 minutes (2 x 15 minutes).

Lastly, if the wait is longer than 1 hour, the system will just say 'more than an hour'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment