This project is a Java-based application designed to analyze survey data related to life quality and demographic information. It features a custom hash table implementation to efficiently store and manage survey responses, enabling fast retrieval and comprehensive analysis. The project highlights proficiency in data structures, file I/O, object-oriented programming, and data analysis, making it a strong addition to a professional portfolio.
- Features
- Technologies Used
- Installation and Setup
- Usage
- Project Structure
- Contributing
- License
- Contact
- Custom Hash Table Implementation:
- Uses integer keys (response IDs) and
Response
objects as values. - Implements linear probing for collision resolution.
- Supports dynamic resizing based on a load factor of 0.5.
- Provides methods for insertion, search, deletion, and printing the table.
- Uses integer keys (response IDs) and
- Data Parsing:
- Reads tab-separated survey data from a file (
responses.txt
) and populates the hash table.
- Reads tab-separated survey data from a file (
- Demographic Analysis:
- Distributions for gender, age group, residence, education level, income source, marital status, and smoking status.
- Life Quality Analysis:
- Calculates average life quality scores overall and segmented by demographic factors (e.g., gender, age, residence).
- Analyzes life quality based on mixed conditions (e.g., marital status and residence) and specific survey responses.
- Additional Insights:
- Identifies the most common treatments, symptoms, and affected life aspects using sorting algorithms.
- Testing:
- Includes a test suite (
Tests.java
) to verify the accuracy of analysis methods against expected results.
- Includes a test suite (
- Java: Built with standard Java (JDK 8 or higher), leveraging its object-oriented capabilities and core libraries for file handling and data processing.
Follow these steps to set up and run the project locally:
-
Prerequisites:
- Install Java Development Kit (JDK) 8 or higher on your system.
-
Clone the Repository:
git clone https://github.com/yourusername/survey-data-analyzer.git
-
Navigate to the Project Directory:
cd survey-data-analyzer
- Prepare the Survey Data File:
- Place the
responses.txt
file in thesrc
directory. This file should contain tab-separated survey responses (seeReadFile.java
for the expected format).
- Compile the Java Files:
- Navigate to the
src
directory (if applicable):
cd src
- Compile all Java files:
javac *.java
- Run the Application:
- Execute the
Tests
class to run the analysis and tests:
java Tests
- Execute the
- Input: The program reads survey data from
responses.txt
in thesrc
directory. Each line represents a response with fields like ID, gender, age, and survey answers (tab-separated). - Output: Running
java Tests
executes a suite of tests that invoke analysis methods and print results to the console, comparing them against expected values for validation. - Customization: Modify
Tests.java
to explore different analyses or adaptReadFile.java
to handle alternative file formats or paths.
Example Command:
java Tests
This runs the predefined tests, displaying whether each analysis matches the expected output.
CustomHashTable.java
:- Implements a hash table with linear probing and dynamic resizing.
- Supports insertion, search, deletion, and printing of entries.
ReadFile.java
:- Reads and parses responses.txt, creating Response objects and inserting them into the hash table.
Response.java
:- Encapsulates a single survey response with demographic data and survey answers.
- Computes a Quality score based on specific survey questions.
SurveyDataAnalyzer.java
:- Contains methods for demographic and life quality analysis, including distribution counts and averages.
- Identifies common treatments, symptoms, and life aspects using insertion sort.
TestResponse.java
:- A simple test class to demonstrate Response object creation and printing.
Tests.java
:- Main entry point with a test suite to validate analysis methods against expected results.
This project is licensed under the MIT License.
For inquiries or further discussion, reach out to me at akiliu1116@gmail.com