Programming: Ruby

Events Calendar

Due Date: Thursday, February 15
Points: 30

These recipes from the cookbook may be helpful as you work on this problem:

For this homework you are going to write a program to manage an events calendar. All the events are stored in a file. When the program starts all the events should be read in from the file. Then you will provide 2 options for the user. They should be allowed to either input a date and see the events for that date, or they should be allowed to list all the events for all the days. If they choose to list all the events, the events should be listed in order with the earliest events listed first. For this problem we will only consider the day an event occurs and will not worry about the time, so events on a given day may be printed out of order.

File Format: The input file should have the name events.text. All events will be stored in 2 lines. The first line will be the date of the event and the second line will be a brief description of the event. The format of the date line will be year month day as integers separated by a single space. You should NOT assume that the events are stored in any particular order. They are simply added to the file as they come in. It is your responsibility to order the events as you read them in from the file. Here are some sample lines from the file

2007 1 21
MLK convocation at 11 in Dowstra
2007 2 8
Ruby test at 9:30 in 141 VSC
2007 1 10
Classes Begin!

Suggested approach: You are not required to follow this approach, but here is my suggestion for approaching this problem:


Return to the Programming: Ruby Home Page