My first attempt at a ruby program. Copied from a book