Giter Site home page Giter Site logo

cpsc360-assignment2's Introduction

cpsc360-assignment2

For some people,text-to-speech programs work better when reading numbers using words (e.g., one hundred and forty-two) rather than digits (e.g., 142). To help them, write a program totranslatenon-negative integers into wordsusing these rules:

•English has unique names for the numbers 0-19: “zero”, “one”, “two”, “three”, “four”, “five”, “six”, “seven”, "eight”, “nine”, “ten”, “eleven”, “twelve”, “thirteen”, “fourteen”, “fifteen”, “sixteen”, “seventeen”, “eighteen”, “nineteen”.

•The subsequent multiples of 10 are named “twenty”, “thirty”, “forty”, “fifty”, “sixty”, “seventy”, “eighty”, “ninety”.

•The combination of one of those multiples of ten with a digit 1-9 is always hyphenated: e.g., 31 ⇒“thirty-one”, 77 ⇒“seventy-seven”.

•Multiples of 100 are counted 1-9 and set off from any following non-zero digits by “and”: e.g., 200 ⇒“two hundred”, 412 ⇒“four hundred and twelve”, 777 ⇒“seven hundred and seventy-seven”.

•Thousands and millions are counted off using the above rules to form numbers 1-999, and are set off from any non-zero remainder by a comma: e.g., 1,253,101 ⇒“one million, two hundred and fifty-three thousand, one hundred and one”.

•If a number with a non-empty thousands/millions component is followed by a remainder of 1-99, then instead of a comma the parts are separated by “and”: e.g., 1,000,011 ⇒“one million and eleven”, 20,222,043 ⇒“twenty million, two hundred and twenty-two thousand and forty-three”.

cpsc360-assignment2's People

Contributors

erinrutan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.