Skip to content

provostprovost/balance-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Balance Reader

A program to read a bank balance dollar amount in English, using my goofy voice.

All relevant logic is here: balance_reader.js

When the form is submitted, balance_reader.js strips non-numerical characters and converts the number into an array of strings with the balanceToText function. It then plays the first sound ("yourbalanceis.mp3") with the function playSound, and when that is finished playing ( .on('ended') ), iterates through the rest of the array.

##balanceToText

This function takes in numerical string and outputs an array of English words. It gets the appropriate words with the twoDigits and threeDigits functions, then concatenates them into the following format:

"Your balance is" + billions + millions + thousands + hundreds + "dollar(s)" + "and" + cents + "cent(s)"

##playSound

This function concatenates the string with the correct directory and extension to form a path for the MP3 file. It sets the src of the window's audio player to the appropriate file and then plays it.

About

Type in a dollar amount and I will read it to you in English!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published