Code your solution in the meal_choice.rb
file.
Your job is to define three methods, breakfast
, lunch
and dinner
that take in a food as a string and returns a string stating the appropriate time to eat that food. For example, calling breakfast("scrambled eggs")
should return something like "Morning is the best time for scrambled eggs!"
Include a default meal_choice for each method so that if no food is specified, it defaults to the following foods:
- Breakfast should default to frosted flakes if no argument is passed in
- Lunch should default to grilled cheese if no argument is passed in
- Dinner should default to salmon if no argument is passed in
For example, calling breakfast
with no argument should return "Morning is the best time for Frosted Flakes!"
Take a look at the example code to get started.
Call all of your methods (with and without arguments) at the bottom of the file. Then run your program.
- Learn to Program - 9.1 Method Parameters, page 72
KWK-L1 Hungry? Why Wait? Grab A...