Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Philadelphia Parking Violations and Property Data Analysis

This Java application processes and analyzes data from OpenDataPhilly regarding parking violations and property values in Philadelphia.

Project Structure

src/
├── common/
│   ├── ParkingViolation.java        # Data model for parking violations
│   └── Property.java                # Data model for properties
├── datamanagement/
│   ├── ParkingViolationReader.java  # Reads parking violations from CSV/JSON
│   ├── PropertyReader.java          # Reads property data from CSV
│   └── PopulationReader.java        # Reads population data
├── processor/
│   ├── DataProcessor.java           # Performs calculations and data processing
│   └── ViolationList.java            # Iterator implementation for violations
└── presentation/
    └── Main.java                     # Main entry point with menu system

UML Class Diagram

The following UML class diagram shows the structure and relationships between all classes in the system:

UML Class Diagram

This diagram shows a layered Java application organized into four packages: common, datamanagement, processor, and presentation. The common package contains the domain model classes ParkingViolation and Property, which are simple data holders with validation methods. The datamanagement package provides reader classes (ParkingViolationReader, PropertyReader, and PopulationReader) responsible for loading raw data from CSV/JSON files and constructing the corresponding domain objects or population map. The processor package contains ViolationList, an iterator wrapper over a list of ParkingViolation objects, and DataProcessor, a singleton class that aggregates violations, properties, and population data and exposes all core computation methods (e.g., fines per capita, averages, etc.). ViolationList implements the Iterator<ParkingViolation> interface and is used internally by DataProcessor to traverse violations. Finally, the presentation package contains the Main class, which serves as the program’s entry point: it invokes the reader classes to load data, initializes the DataProcessor singleton, and drives the menu-based user interface that calls the appropriate processing methods.

Requirements

  • Java 8 or higher
  • JSON.simple library (json-simple-1.1.1.jar)

Setup

  1. The JSON.simple library json-simple-1.1.1.jar is already included in the lib/ directory.

  2. Create a folder named data/ in root directory. Download sample data input files and save them in data/.

  3. Compile the Java files:

    mkdir -p bin
    javac -d bin -sourcepath src -cp ".:lib/json-simple-1.1.1.jar" \
      src/common/*.java \
      src/datamanagement/*.java \
      src/processor/*.java \
      src/presentation/*.java
  4. Run the program:

    java -cp ".:bin:lib/json-simple-1.1.1.jar" presentation.Main <format> <parking_file> <properties_file> <population_file>

    CSV Example:

    java -cp ".:bin:lib/json-simple-1.1.1.jar" presentation.Main csv data/parking.csv data/properties.csv data/population.txt

    Or with JSON format:

    java -cp ".:bin:lib/json-simple-1.1.1.jar" presentation.Main json data/parking.json data/properties.csv data/population.txt

Command-Line Arguments

The program requires exactly 4 arguments (in order):

  1. Format: Either csv or json (case-sensitive) - specifies the format of the parking violations file
  2. Parking file: Path to the parking violations file (CSV or JSON)
  3. Properties file: Path to the properties CSV file
  4. Population file: Path to the population text file

Features

The application provides a menu-driven interface with the following options:

  1. Total population for all ZIP codes - Displays the sum of all populations
  2. Fines per capita for each ZIP code - Shows parking fines per person for each ZIP code (only PA violations)
  3. Average residential market value - Calculates average property value for a specified ZIP code
  4. Average residential total livable area - Calculates average square footage for a specified ZIP code
  5. Residential market value per capita - Calculates total property value divided by population for a ZIP code
  6. Exit - Terminates the program

Program Usage

After starting the program with valid arguments, you will see the main menu. The program uses a menu-driven interface where you select options by entering numbers.

Main Menu

The main menu displays the following options:

Main Menu:
1. Total population for all ZIP codes
2. Fines per capita for each ZIP code
3. Average residential market value for a ZIP code
4. Average residential total livable area for a ZIP code
5. Residential market value per capita for a ZIP code
0. Exit
Enter your choice:

Input: Enter a number (0-5) corresponding to your desired option.

Output: The menu will be displayed again after each operation completes.

Menu Option 1: Total Population for All ZIP Codes

Input: Enter 1 when prompted at the main menu.

Expected Output:

Total population for all ZIP codes: 1526206

Menu Option 1 Screenshot

Menu Option 2: Fines Per Capita for Each ZIP Code

Input: Enter 2 when prompted at the main menu.

Expected Output:

19103 0.0284
19104 0.0312
...

The output displays:

  • One ZIP code per line
  • ZIP code in ascending numerical order
  • Fines per capita formatted to 4 decimal places
  • Only ZIP codes with non-zero fines and population

Menu Option 2 Screenshot

Notes for Option 3-5:

  • The program accepts multiple ZIP codes separated by commas
  • ZIP codes are automatically normalized to their first 5 digits
  • If a ZIP code has no residences, the value displayed will be 0
  • Invalid market values (missing, non-numeric, negative, or zero) are ignored

Menu Option 3: Average Residential Market Value

Input:

  1. Enter 3 when prompted at the main menu.
  2. When prompted "Enter ZIP codes separated by commas (e.g., 19103,19104):", enter one or more ZIP codes separated by commas.

Example Input: 19103 or multiple codes like 19103,19104

Expected Output (single ZIP code):

ZIP 19103: Average residential market value: 2015974

Menu Option 3 Single Screenshot

Expected Output (multiple ZIP codes):

ZIP 19103: Average residential market value: 2015974
ZIP 19104: Average residential market value: 922763

Menu Option 3 Multiple Screenshot

Menu Option 4: Average Residential Total Livable Area

Input:

  1. Enter 4 when prompted at the main menu.
  2. When prompted "Enter ZIP codes separated by commas (e.g., 19103,19104):", enter one or more ZIP codes separated by commas.

Example Input: 19103 or multiple codes like 19103,19104

Expected Output (single ZIP code):

ZIP 19103: Average residential total livable area: 7837

Menu Option 4 Single Screenshot

Expected Output (multiple ZIP codes):

ZIP 19103: Average residential total livable area: 7837
ZIP 19104: Average residential total livable area: 6361

Menu Option 4 Multiple Screenshot

Menu Option 5: Residential Market Value Per Capita

Input:

  1. Enter 5 when prompted at the main menu.
  2. When prompted "Enter ZIP codes separated by commas (e.g., 19103,19104):", enter one or more ZIP codes separated by commas.

Example Input: 19103 or multiple codes like 19103,19104

Expected Output (single ZIP code):

ZIP 19103: Residential market value per capita: 717020

Menu Option 5 Single Screenshot

Expected Output (multiple ZIP codes):

ZIP 19103: Residential market value per capita: 717020
ZIP 19104: Residential market value per capita: 209994

Menu Option 5 Multiple Screenshot

Menu Option 0: Exit

Input: Enter 0 when prompted at the main menu.

Expected Output:

Exiting program. Goodbye!

Menu Option 0 Screenshot

The program will then terminate.

Invalid Input Handling

  • If you enter a non-integer value at the main menu, the menu will be displayed again
  • If you enter an invalid menu option (not 0-5), the menu will be displayed again
  • Invalid ZIP code inputs will result in a value of 0 being displayed (for options 3, 4, and 5)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages