Exercise : Debug ZipCode Case Study

In this exercise we will practice the jGRASP debugger using the Case Study example from the end of Chapter 6. To download this example, follow these steps:

  1. Go to the class web page and click the "Textbook" link.
  2. Find the section labeled "Code Files" and click the "code files" link.
  3. This will bring you to a directory listing that includes an entry for each chapter. Click the link for "ch06".
  4. You want to download and save the files ZipLookup.java and zipcode.txt. Right-click the file names and choose the option to save the link in whatever folder you have been using for lab work. Make sure to save them in the same folder.
  5. Compile and run ZipLookup.java in jGRASP. You might try using your own ZIP code and a relatively small radius like 0.5 miles. The program takes a while to run because it has to search a large data file.

continued on the next slide...

Exercise - jGRASP Debugger

continued on the next slide...

Exercise - jGRASP Debugger

continued on the next slide...

Exercise - jGRASP Debugger

Clear your previous break point and set a new break point inside on the printf inside the if. Then hit the resume button that looks like a play button and fill in the table below with the values for zip, lat2, and long2.

zip lat2 long2
20045 38.896599 -77.0319
20500 38.894781 -77.036122
20501 38.89872 -77.036198
20502 38.89872 -77.036198