Practice WOD: File IO CountWords

Prior to starting this WOD, you might want to familiarize yourself with the StringTokenizer class.

Instructions

  1. Start your timer.
  2. Create an Eclipse project called FileIO-CountWords.
  3. Enable Checkstyle for this project.
  4. Write a program that reads in webpage.html, determines how many whitespace-delimited tokens (i.e. “words”) are in the file, and writes that integer to System.out.

When finished, stop your timer, and record how many minutes it took you to complete the WOD. Your program must satisfy our coding standards. You can copy/paste code from the prior program.

Rx: <10 min Av: 10-15 min Sd: 15-20 min DNF: 20+ min

Demonstration

Once you’ve finished doing the WOD a single time, watch me do it:

Standard WOD Caveats

You’ll learn significantly less from watching me solve the WOD if you haven’t attempted the WOD yourself first.

While it’s an achievement to finish the WOD no matter how long it takes, you might experience “diminishing returns” if you work longer than the DNF time. Thus, it might be strategic to stop working at the DNF time and watch my solution.

After watching my solution, I recommend that you repeat the WOD if you have not achieved at least Av performance. If so, be sure to:

Feel free to keep trying until you make Rx if that’s of interest to you.