/number-to-words

[ruby, exercises, algorithms]

Primary LanguageRuby

Numbers to Words

Note: This is a pair programming activity.

Exercise

Introduction

  • Start by pseudo-coding with your partner. Focus on the low numbers first.

Challenge

  • In this lab we will be creating an algorithm to_words that can turn Arabic numbers into english words:

    to_words(1)   # => "one"
    to_words(32)  # => "thirty two"
    to_words(185) # => "one hundred eighty five"
    
    • Start by pseudo-coding and start by thinking only about the numbers under 10. Then work on numbers up to 100.

Bonus:

  • Can your algorithm work for numbers 100-999?
  • Can it work up to 1000? 1000000?
  • Can you make your algorithm recursive?

Self Evaluation

During the previous exercise, rate your progress on a scale of 1-5 (5 being the highest) for the following criteria:

  • Persistence: Do you handle frustration well? Do you independently pursue understanding?
  • Organization: Do you thoughtfully implement best coding patterns and practices?
  • Collaboration: Do you make an effort solve problems and share your ideas with others?
  • Communication: Do you clearly convey your thoughts to others in illustrative and clear ways?
  • Self-compassion: Do you make productive use of turning failures into learning opportunities?
  • Resourcefulness: Do make an effort to compare and contrast new ideas with ones you already know?