Practice WOD: Web IO FrequencyURL

Prior to starting this WOD, you may want to review the TreeMap class.

Instructions

  1. Start your timer.
  2. Create an Eclipse project called WebIO-FrequencyURL.
  3. Enable Checkstyle for this project.
  4. Write a program that reads in a URL from the command line, and prints out a list of the whitespace-delimited tokens found in that URL and their frequency. The list should be sorted in alphabetical order.

For example, if the URL retrieves a page containing the text “twinkle twinkle little star”, the output might look like:

little 1
star 1
twinkle 2

If the page cannot be retrieved (i.e. the URL is malformed), then the program should signal an error.

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: <12 min Av: 12-16 min Sd: 16-25 min DNF: 25+ 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.