This small Java project serves as a practice exercise to explore basic file operations, exception handling, and data manipulation in Java. The application reads from a simple text file containing details of individuals, processes the information, and performs basic filtering based on criteria.
- Reading Data: The application reads data from
people.txt
usingFileHelper
, which stores each line as a string in a list. - Data Conversion:
PersonOperationHelper
converts these string entries intoPerson
objects, using a custom format specified in the text file. - Error Handling: Implements custom exception handling for data conversion errors, particularly focusing on salary values.
- Data Filtering: The
Main
class includes a method to filterPerson
objects based on surname start, sex, and a limit to the number of results.
To run this application, compile and execute the Main.java
. It requires no command line arguments but will automatically process data as per the hardcoded logic in the main
method.
- src/com/company/Main.java: Contains the
main
method that orchestrates the reading of data from a file, processing it intoPerson
objects, and filtering based on specific attributes. - src/First/FileHelper.java: Handles reading lines from a file and storing them in a list.
- src/First/InvalidSalaryException.java: Custom exception class for handling invalid salary data.
- src/First/Person.java: Data model class representing an individual with attributes like name, surname, age, city, salary, and sex.
- src/First/PersonOperationHelper.java: Provides functionality to convert lines of text into
Person
objects. - src/First/people.txt: Text file containing semi-colon separated values representing people.
Files:
- 📁 src
- 📁 com
- 📁 company
Main.java
- 📁 company
- 📁 First
FileHelper.java
InvalidSalaryException.java
people.txt
Person.java
PersonOperationHelper.java
- 📁 com