completed exercise 14 in groovy language