Day3: Let's write a simple application that converts words to into minutes by calculating an estimated time required to read manually.
Let's write a simple application that converts words into minutes by calculating an estimated time required to read manually.
The algorithm is as follows:
- First, find the word count. Let's say it's 936 words.
- Divide your total word count by 200. You'll get a decimal number, in this case, 4.69.
- The first part of your decimal number is your minute. In this case, it is 4.
- Take the second part of your decimal, the points which is 0.69, multiply that by 0.60. Those are your seconds. Round them up or down as necessary to get a whole second. In this case, 0.69*0.60 = 0.414. We will round that up to 41 seconds. The result? 938 words = a 4 minute, 41-second read. But that’s really specific. Why not round that time to make things simpler for your reader? Anything less than 30 seconds gets ignored; anything more than 30 seconds gets rounded up to the next minute. Ta-da! That rounding makes your 938-word article a 5-minute read.