Back to Challenge Set 18

Code Challenge: Log Counter

Difficulty  

divider

The Brief

What they asked for
Our server writes a status word every time it does anything.
I want to know how many of each. And I want to know how many
lines you had to read to find that out, because the log gets
big and I am worried about it.

Write your requirements list before you write any code. Input, calculate, output, and anything you had to decide for yourself.


Notes

  • Counting is not searching. A search can stop as soon as it finds one; a count cannot.
  • Report the checks alongside the count. The point of this challenge is to notice that the check count never changes.
  • Run it for a word that does not appear at all.

Sample Output

Sample Output
ok: 4 (checked 7)
fail: 2 (checked 7)
crash: 0 (checked 7)

Every word costs seven checks, whether it appears four times or never — Activity 2.9's CountInHouse again.


Submit

Your requirements list and your program file, named cc-log-counter.

Commence Challenge