this is the first version of this OO exercise in the 2nd week of the
coursera course. Both functions have been written with the help of
Bill Hilton's tutorial (reposted by Pavel Kirjanas in the forum,
here https://class.coursera.org/rprog-016/forum/thread?thread_id=96.