CS 151 - Introduction to Data Structures

Homework 3

Lists - Zipcode lookup

Read the program design principles and code formatting standards carefully. You are expected to adhere to all stated standards.

Overview

This project uses the List151Impl class and object-oriented design with inheritance. The general idea is that you are given file containing data about zip codes. Each line of the file contains data about exactly one zip code. However, some of the data is missing on some of the lines. The goal is to create classes that store exactly the available information about each zip code, and no more. So, you will create classes with inheritance that allow you to store all the data available in the minimum possible space. All of the data must be stored in a single instance of a class that implements List151 (in other words List151Impl). You will then query this container to deliver information about zip codes.

Code is available by scp at
/var/www/html/cs151/Data/Hw3/List151.java
/var/www/html/cs151/Data/Hw3/List151Impl.java
/var/www/html/cs151/Data/Hw3/BagOfStuff.java
Use scp to get the code. For example:

                  scp YOURUNIXLOGIN@web2.cs.brynmawr.edu:/var/www/html/cs151/Data/Hw3/BagOfStuff.java BagOfStuff.java
            
or from the web at (for example):
            https://cs.brynmawr.edu/cs151/Data/Hw3/List151.java
            https://cs.brynmawr.edu/cs151/Data/Hw3/BagOfStuff.java
            https://cs.brynmawr.edu/cs151/Data/Hw3/List151Impl.java
      
You will need to use scp to get files from this location regardless of whether you are on your personal laptop or one of the department computers.

Data

shuffzips.csv

The data for this assignment is available at /var/www/html/cs151/Data/Hw3/shuffzips.csv. As above this file is available through your browser or scp.
The lines in this file contain 12 comma-separated fields that look like the three lines below.
      00705,STANDARD,AIBONITO,PR,PRIMARY,18.14,-66.26,NA-US-PR-AIBONITO,false,,,
      09005,MILITARY,APO,AE,PRIMARY,,,EU-DE-WEISBADEN AAF OMDC,false,,,
      10029,STANDARD,NEW YORK,NY,PRIMARY,40.71,-73.99,NA-US-NY-NEW YORK,false,31490,48403,1050141146
There is no header line. Initialize your instance of List151Impl so it can hold at least 50000 entries.

The fields in each row are:

  1. zip code
  2. type -- ignored
  3. city name
  4. state abbreviation
  5. type 2 -- ignored
  6. Latitude
  7. Longitude
  8. long code -- ignored
  9. true or false -- ignored
  10. population 1
  11. population 2
  12. another number -- ignored

For this assignment we care about only: zip code, city name, state, latitude, longitude and population 2. Some lines are missing the longitude and latitude and population (the second sample line above), some are missing population but have longitude and latitude (the first sample line above). All lines have the correct number of commas (11). There are no lines for which the longitude and latitude are not known but the population is known.

Given this description, the data falls into 3 groups:

  1. those for which location and population are known
  2. those for which only location is known
  3. those for which neither location nor population is known.
Your first task is to design a set of java classes so that each of these groups can be stored in an instance that is capable of storing the available information, and no more. These java classes MUST be linked to each other using inheritance. For instance, if you define a class Place that stores group 3 data, then you might make a class
      public class LocatedPlace extends Place
to store group 2 data and another class for a place for which the population is also known.

Requirements

3 Electronic Submissions

The directions are slightly changed from homework 1

Your submission will be handed in using the submit script.

If you write your program on computers other than those in the lab, be aware that your program will be graded based on how it runs on the department’s Linux server, not how it runs on your computer. If you are using Java 11, you will not have any problems with Java compatability. A way you might get into trouble is, for instance, if you developed this program on your personal computer and made a local copy of the uszipcodes.csv file and hardcoded the address of that file on your computer into your program.

Make a README

Once you have finished coding (and fully commenting your code) make a README file. This file should follow the format of this sample README. This is your opportunity to tell me what went well or poorly, what is still broken and why, etc. I will read, and often respond to, everything you write in the README.

The easiest place to write your readme is within VSC. Make a file just like a standard java file but name it README.txt then just write in it. You should start by copying the sample readme.

Submit

If you developed this program on your own computer, do the following to transfer your program to the Linux computers so you will be able to submit.

  1. Open a terminal window on your computer (a windows powershell or a Mac terminal)
  2. Connect to a the CS file server
                                       ssh YOURUNIXNAME@goldengate.cs.brynmawr.edu
                                 
    Enter your Unix password when prompted
  3. On the linux computer:
                                       cd CS151
                                       mkdir a3
                                 
    You made the CS151 directory in Lab 1 . You can change a3 to whatever you like, the directions below assume a3.
  4. Leave this terminal window open and connected to Linux, you will use it again in a couple of steps
  5. Within VSC open for your homework 3 project ... open a terminal by going to the Terminal menu and selecting "new terminal"
  6. In the Terminal inside of VSC (usually the lower right third of the screen) you should be in the directory containing your program. Enter
                                       scp * YOURNAME@goldengate.cs.brynmawr.edu:cs151/a3
                                 
  7. You should get messages on screen showing that each file in this directory has been copied.
  8. Confirm that the copy was successful. Back in the Terminal you opened on the Linux machines (in step 2)
                                       ls a3
                                 
    This should show a list of of the files you just copied in your scp command.
  9. When all of the files are in the a3 directory and you are still in the CS151 directory
                                       /home/gtowell/bin/submit  -c 151 -p 3 -d a3
                                 
    This says to submit for project 3 (-p) everything in the directory a3 (-d) for the class 151 (-c). You should see listing of all the files you submitted and a message that says "success".
  10. You can submit multiple times. I will grade only the last submission -- unless you tell me otherwise. The submission process attaches a timestamp so I know when you submitted (down to the second). The closest submission I have ever received to the deadline is 7 seconds.

Approximate Grading

Grades for this assignment will be assigned according the to the following rough percentages
  1. 40% -- Program follows requirements above
  2. 20% -- Program compiles and runs
  3. 20% -- program follows style and design guidelines
  4. 10% -- Readme
  5. 10% -- Other