Another Date Class

hi,

I need to develop new date class in ruby rather then built in date class
program needs to do these things below

  1. Read a series of dates from an ASCII text file. You can assume that
    all dates in the file are in an acceptable format, with the elements in
    the order day, month and year, with the separator being any non-numeric
    character. A suitable input file is provided on the course web site.
  2. If a date is in error, use exceptions to handle the error and
    discard any erroneous dates. Any error messages should be displayed to
    the console.
  3. Sort the valid dates read from the text file into ascending order.
  4. Dates should be able to be displayed in two formats – either
    17/07/2008 or 17th July 2008.
  5. Implement an increment method that increments the date by a day

Test Data
21/07/2008
22 07 2008
23:07:2008
1/1/2001
29/2/2004
29/2/2003
-2/13/2008

I’m new in ruby just need some help at least for a start.

Hmmm Hmmm wrote:

  1. Sort the valid dates read from the text file into ascending order.
  2. Dates should be able to be displayed in two formats – either
    17/07/2008 or 17th July 2008.
  3. Implement an increment method that increments the date by a day

This looks an awful lot like homework.

Bill W. wrote:

Hmmm Hmmm wrote:

I need to develop new date class in ruby rather then built in date class
program needs to do these things below

This looks an awful lot like homework.

Yes. Somebody going by the name “Michael C.” posted the same question
two days ago. It’s a pity that “Michael” and “Hmmmm” can’t work on a
solution together.

It truly is Eternal September. I wonder if the instructor is clueful
enough to read ruby-talk?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs