Lesson 2 of 546 minModule progress 0%

Module 19: Advanced Capstone Portfolio

Capstone 2: Expense Tracker with File Processing

Create an expense tracker that reads, writes, and summarizes transaction data cleanly. This project is a good portfolio piece because it combines file handling, parsing, collections, reporting, and validation in a domain that is easy for reviewers to understand.

Author

Java Learner Editorial Team

Reviewer

Technical review by Java Learner

Last reviewed

2026-04-17

Java version

Java 25 LTS

How this lesson was prepared: AI-assisted draft, manually expanded into a full lesson guide, and checked against current official Java, Spring, testing, and delivery documentation.

Learning goals

  • Process structured input such as CSV or plain text into useful Java objects
  • Use collections and aggregation logic to calculate category totals and reports
  • Deliver a small data-processing application with reliable error handling

Before you start

  • You completed the earlier advanced modules or can already build small Java applications independently

Lesson roadmap: Start with the mental model, then follow the design choices, common pitfalls, and the practical workflow you should apply in a real project.

Project goal: Read expenses from files or user input, group them by category, and produce totals and summaries.

What to practice: File IO, parsing, validation, collections, and formatted reporting.

Stretch ideas: Add recurring expenses, monthly summaries, import/export, or keyword-based category rules.

Success check: The tracker should turn messy input into reliable usable output.

Project goal: Record expenses with a date, amount, category, and note, then show summaries such as total spend, per-category totals, and filtered reports by month or category.

Suggested design: Parse each row into an Expense object, store them in a list, and build summary maps when generating reports. Keep parsing, storage, and reporting logic in separate methods or classes.

Milestone plan: Start with add and list, then import from file, then export or save, then category totals, then monthly reports and validation.

Stretch ideas: Support recurring expenses, budgets, or warnings when a category exceeds a limit. These are good second-phase features after the basic parser and report flow are reliable.

How to use the capstones: Build them like portfolio pieces, not toy exercises. Write down the scope first, finish a thin vertical slice, and only then add polish, tests, extra features, or deployment steps.

Project review mindset: A strong capstone shows design choices, not just code volume. Clear boundaries, naming, validation, error handling, and a short README often matter more than adding ten extra features.

Delivery habit: Each finished project should include a problem statement, setup instructions, example input and output, and at least one obvious next improvement for future iteration.

Runnable examples

A category total is a natural map problem

Map<String, Double> totalsByCategory = new HashMap<>();

Expected output

The tracker can accumulate totals by category efficiently.

A map is a clean way to track category totals

Map<String, Double> totals = new HashMap<>();
totals.merge("Food", 12.50, Double::sum);
totals.merge("Food", 7.50, Double::sum);
System.out.println(totals.get("Food"));

Expected output

20.0

Common mistakes

Mixing file parsing, validation, and report formatting in one loop

Separate import, domain validation, and reporting so each part is easier to change and test.

Assuming every file row is valid and crashing on the first malformed line

Decide how invalid rows should be reported, skipped, or rejected with a helpful message.

Mini exercise

Define the file format for one expense row and list the validation rules for date, amount, and category before you write the parser.

Summary

  • This capstone combines parsing, validation, and summary generation.
  • Maps and lists usually work together here.
  • A realistic tracker must handle bad input cleanly.
  • This capstone shows practical data processing, not just CRUD operations.
  • Parsing and reporting are easier to maintain when they are separated from each other.

Next step

The third capstone adds concurrency and coordination under load.

Sources used

Advertisement

Lesson check

Why is an expense tracker a strong capstone?

Next lesson →