CS 151 - Introduction to Data Structures

Homework 4

Sorted Array Lists and Zip Code lookup

As usual, read the program design principles and code formatting standards carefully. You are expected to adhere to all stated standards.

Overview

This project builds on that of last week. The difference is that last week you were a user of the List151 class, this week you will be a developer working to extend that class. All of your programming will be in the data structure underlying the user interface.

As you work on this assignment, keep in mind that only a small portion of your grade will be based on the user interface. So, only fix errors in the interface for Homework 3 if they are egregious.

Data

The data file is the same as that used in Homework 3 (except that it contains more than 40000 entries rather than only about 10 in HW3.) Click here of a description of the data file.

The data for this assignment is available via scp from goldengate.cs.brynmawr.edu at /home/gtowell/Public/cs151/Data/Hw4/shuffzips.csv (If you are logged in on a lab machine, this file is freely available at that location as well.) The file is also on the web at

            https://cs.brynmawr.edu/cs151/Data/Hw4/shuffzips.csv
      

Class design

Use the same classes: Place, LocatedPlace and PopulatedPlace as in Homework 3. If they worked in Homework 3 they should work again in Homework 4. Similarly your Main class-- which implements the user interface -- should be able to be reused with only minor changes. The biggest change to your existing code (in the main method) will be to replace the string "List151Impl" with "SortedArrayList".

List151Impl

Edit this file to change the two instance variables of this class (count and arra) from "private" to "protected" (if you have not already done so). Doing so is not strictly required, but it will certainly make things easier. Make NO other changes to the List151Impl.java file.

SortedArrayList

Create a new class named SortedArrayList that extends List151Impl. Do the following with SortedArrayList (Note that in this section where you see the word "change", what you will actually be doing is writing a new version of the "changed" method in SortedArrayList that overrides the method in List151Impl. ):

Requirements

Electronic Submissions

Your program will be graded based on how it runs on the department’s Linux server, not how it runs on your computer. Be sure to include with your submission:

1. README:

The usual plain text file README
2. Source files:
All .java files that are not part of the standard Java libraries, regardless of whether you wrote them or simply used ones supplied with the assignment. (Your program should be able to run using only the Java files you submit.)
4. Output file
The requested output from you program (See that last requirement above.)
DO NOT INCLUDE:
Data files that are read from the course website. ".class" files that result for compiling java code.

The following steps for submission assume that you created a project directory named HW4 in the directory /home/YOU/CS151/ on the UNIX servers

  1. Make sure all of your code files and the requested output file are in that directory. (Use scp as needed to copy files from your local machine to that directory on UNIX)
  2. Similarly put the README file into the project directory on UNIX
  3. On a UNIX machine, go to the directory /home/YOU/CS151
  4. Enter /home/gtowell/bin/submit -c 151 -p 4 -d HW4
For a longer version of these instructions see the previous assignments.

Approximate Grading

Grades for this assignment will be assigned according the to the following rough percentages
  1. 45% -- Program follows requirements above. Most of this will be in the SortedArrayList class. Note that this includes the requested output file
  2. 20% -- Program compiles and runs
  3. 15% -- program follows style and design guidelines
  4. 10% -- Readme
  5. 10% -- Other