I had a strange problem with this code:
legibIndex = 206.385 - 84.6 * (countSylb / countWord) - 1.015 * (countWord / countSent);
This is a calculation of the clarity index of a given text file. Since this is homework, we were told what should be the index (80 or exactly 80.3)
The number of my syllables, the number of words and the number of sentences are correct (they coincide with the given numbers for sample text files.
Even if I hardcode the numbers, I don't get 80, although I do it when I put it in my cactulator exactly as you can see. I can not imagine what is wrong.
Here is the equation we gave:
Index = 206.835 - 84.6 * (# syllables/# words) - 1.015 * (# words/# sentences)
As you can see, I just connected my variables (which contain the correct values. For reference, the values ββare: 55 syllables, 40 words, 4 sentences, as indicated by the instructor. The values ββthat my program creates at startup are the readability index 112.
Did I miss some brackets or what? I'm at a dead end!
source share