/Bag-o-Loot

An exercise that is mainly for practicing test driven development

Primary LanguageJavaScript

Instructions

You have an acquaintance whose job is to, once a year, delivery presents to the best kids around the world. They have a problem, though. There are so many good boys and girls in the world now, that their old paper accounting systems just don't cut it anymore. They want you to write a program that will let them do the following tasks.

  1. Add a toy to the bag o' loot, and label it with the child's name who will receive it.

    ./lootbag.js add kite suzy
    ./lootbag.js add baseball michael
  2. Remove a toy from the bag o' loot in case a child's status changes before delivery starts.

    ./lootbag.js remove suzy kite
    ./lootbag.js remove michael baseball
  3. Produce a list of children currently receiving presents.

    ./lootbag.js ls
  4. List toys in the bag o' loot for a specific child.

    ./lootbag.js ls suzy
  5. Specify when a child's toys have been delivered.

    ./lootbag.js delivered suzy

Requirements

Write a test before you write implementation code

  1. Items can be added to bag.
  2. Items can be removed from bag, per child only. Removing ball from the bag should not be allowed. A child's name must be specified.
  3. Must be able to list all children who are getting a toy.
  4. Must be able to list all toys for a given child's name.
  5. Must be able to set the delivered property of a child, which defaults to false to true.

Bonus Features

  1. Write a help response that lists all of the possible arguments, and what they do.
  2. Create a shortcut combination of arguments that can remove all toys from the bag for a child who has been deemed naughty.