Episode 20 - Hashes As Objects

  1. Use hashes to define three types of cars. Identify the cars' make (brand), model, color, and year. (Example: a silver 2006 Honda Accord)
  2. Assume you have the following code:
    drink1 = {"name" => "Seltzer", "ingredients" => ["water", "bubbles"]}
    drink2 = {"name" => "Coca Cola", "ingredients" => ["water", "bubbles", "sugar", "brown food coloring"]}
    drink3 = {"name" => "water", "ingredients" => ["hydrogen", "oxygen"]}
    Write additional code so that the terminal outputs:
    The drink Seltzer has the ingredients: water, bubbles.
    The drink Coca Cola has the ingredients: water, bubbles, sugar, brown food coloring.
    The drink water has the ingredients: hydrogen, oxygen.
    Note: Write the code in such a way that it would still work even if someone went into the hashes and changed the number of ingredients for any particular drink.