Essential JavaScript

Vegetarian Menu Kata

You are contracting with a restaurant to help them set up an online ordering system. The restaurant has been totally booked lately, so they are expanding their kitchen and hiring more cooks to be able to keep up with demand. They are also letting customers order online for the first time.

They want their online ordering system to use the same numbers as their paper menu, which has been the same for years. Customers are used to this menu and many have memorized their favorite dishes, so the restaurant doesn't want to change things. When someone orders a #9, it should be the same dish as #9 in the paper menu.

One issue that has come up is about vegetarian dishes. In the restaurant, vegetarian dishes are always prepared separately from any meat dishes. Separate cutting boards, knives, pans, etc. are used. However, the new cooks don't know the menu numbers and sometimes mix up which dishes are vegetarian. The head chef wants to make things easy for them.

Fortunately, the menu is very organized. Each section of the menu has all of the vegetarian dishes at the end:

  • Appetizers (#1-12, vegetarian items start at 6)
  • Entrees (#13-34, vegetarian items start at 25)
  • Sides (#35-44, vegetarian items start at 38)
  • Desserts (#45-57, all vegetarian)

Write a function that receives an item number from the menu above and returns true if the item is vegetarian or false otherwise.

Code Editor