Skip to content

Instantly share code, notes, and snippets.

@SoxFace
Forked from epoch/say.md
Last active August 29, 2015 14:14
Show Gist options
  • Save SoxFace/7d88c9edfff4718a1a6c to your computer and use it in GitHub Desktop.
Save SoxFace/7d88c9edfff4718a1a6c to your computer and use it in GitHub Desktop.

Say

Write a program that will take a number from 0 to 99 and spell out that number in English.

In other words, if the input to the program is 22, then the output should be 'twenty-two'

e.g.

Say.new(22).in_english
Say.new(-1).in_english
# say.rb:7:in 'in_english': Number must be between 0 and 99, inclusive. (ArgumentError)

The program must also report any values that are out of range.

Some good test cases for this program are:

  • 0
  • 14
  • 50
  • 98
  • -1
  • 100

Extensions

Shell out to Mac OS X's program to talk out loud.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment