1.
General Project Understanding
1. Aim of the project
To create a lightweight, user-friendly desktop application for tracking
expenses, generating reports, and visualizing spending patterns.
2. Why you chose it
Managing personal expenses manually is tedious. This project
addresses a real-world need while giving you hands-on experience
with Java Swing and third-party libraries.
3. Problem solved
It helps users categorize, track, filter, analyze, and export expenses,
offering better financial awareness and recordkeeping.
4. Target user
Individuals who want an offline, easy-to-use expense logging tool
without needing complex accounting software.
5. Online or offline
It’s fully offline. No internet required—data is stored locally. This
ensures privacy, speed, and ease of use without setup.
6. Mobile adaptation
Could be ported to Android using Java + Android SDK or converted
to a web app using frameworks like React and a backend like
Firebase.
2. Java Concepts & Features Used
1. Java version
Used Java 8 (or 11+) because it supports Swing, JFreeChart, iText,
and the [Link] API (like LocalDate).
2. What is Swing
A Java GUI toolkit (JFrame, JPanel, JButton, etc.). Chosen for its
lightweight nature and desktop integration.
3. What is JTable
A Swing component representing tabular data. You populate it using
a DefaultTableModel with rows from ExpenseEntry.
4. Layout handling
Used BorderLayout, GridLayout, and FlowLayout to structure
components—top panel for input, center for data, bottom for status.
5. Serialization usage
ObjectOutputStream saves the Java objects (profiles, passwords) to
a file (.dat)—making data persistent.
6. Use of HashMap and ArrayList
profiles: Map<String,Map<String,List<ExpenseEntry>>> organizes
expenses by profile → category → list. ArrayList stores expense
entries.
7. Undo functionality
A Stack<ExpenseEntry> captures the last entry. Undo pops and
removes it from storage.
8. What is a Stack
A LIFO structure from [Link]. It allows quick undo by reversing the
last operation.
3. Chart & Reporting Features
1. Charting library
Used JFreeChart for its simplicity, Swing compatibility, and active
maintenance.
2. What is JFreeChart
A Java charting library supporting bar, pie, line charts, etc.
3. Chart creation
Built bar charts using DefaultCategoryDataset, then displayed with
[Link]() and a ChartPanel.
4. Data binding
Totals per category are aggregated, then fed into the dataset used
by the chart.
5. What is iText
A library for creating PDFs programmatically in Java.
6. PDF generation
Created a Document object, set up PdfPTable, added rows with
expense data, then wrote it out using PdfWriter.
7. PDF format
Simple table with headers: Date, Category, Note, Amount, plus basic
headings and date at the top.
4. GUI Design Questions
1. Top panel components
Contains JTextField for amount and note, JComboBox for categories,
“Add” and “Undo” buttons, and a Test Chart button for debugging.
2. Filtering functionality
"This Week" and "This Month" use LocalDate comparisons. Custom
range uses user input and date parsing.
3. Button event handling
Used ActionListener lambdas like e -> addExpense() to trigger
methods.
4. Layout managers used
Used GridLayout for the input panel and FlowLayout for filter
controls, arranged inside a parent BorderLayout.
5. Profile switching
Users can switch/add/delete/rename profiles via menu; stored in
profiles map with optional password prompt.
5. File Handling
1. Data storage location
expense_profiles.dat for profile data, and last_profile.txt for last-
used profile.
2. Java file classes used
ObjectOutputStream & ObjectInputStream for object serialization;
Files API for reading/writing strings/files.
3. Data file format
Binary serialized Java object file for data and a plain-text file for last
profile.
4. Why no database
Simplicity; file-based storage avoids complexity. For multi-user or
cloud-based implementation, a database would be better.
5. Missing data file handling
The app initializes a default profile on load, so it doesn't crash.
Errors are caught and printed/trapped.
6. Error Handling & Validation
1. Non-numeric amount
Wrapped in try-catch(NumberFormatException) and shown an error
dialog.
2. Input validation
Ensures amount is numeric, date format validated during date
parsing, and required fields are not empty.
3. Exception handling
Examples include handling IOException and
ClassNotFoundException during load/save, and show dialogs on
invalid input.
4. Data safety on close
saveProfiles() is called after every change (add, undo, switch),
ensuring minimal data lost.
7. Multi-Profile Logic
1. Profile management
Stored as keys in the profiles map. Users switch via menu — dialog
shows profile list.
2. Optional passwords
Passwords stored in a separate passwords map. Prompted upon
switching if set.
3. Forgotten password
No recovery method; the profile remains locked. User can delete or
rename only with correct password.
4. Password storage
Stored as plain text in serialized file — not secure. Can be improved
using hashing.
8. Code Structure & Refactoring
1. Classes used
One main class (ExpenseTrackerFinalApp) with an inner static
ExpenseEntry. This maintains simplicity.
2. Refactoring plan
Could split logic into:
o ProfileManager
o UIComponents
o ChartExporter
o PDFExporter
3. Code size
Roughly 400–500 lines of code — manageable for a mini project.
4. Hardest part
Integrating JFreeChart + PDF lib while resolving classpath and GUI
layout issues.
5. Performance improvement
Use of caching, background threads for heavy operations like PDF
generation, optimize serialization.
9. Real-World Implementation
1. Commercial deployment changes
o UI polish, secure password storage, packaging (.exe or
installer), database integration.
2. Multiple users on same PC
Separate OS user accounts or unique profiles logically distinguish
users.
3. Conversion to web/mobile
Web: Java Spring Boot + React; Mobile: Android Studio + Java/Kotlin
or Flutter.
4. Cloud storage
APIs to sync to Firebase, AWS DynamoDB, or own RESTful server.
5. Security for sensitive data
Needs encryption, hashing passwords, secure storage (not plain
files).
10. Future Scope
1. Current limitations
No encryption, no offline <-> online sync, no scheduling or budgets.
2. Feature upgrades
Auto-budget alerts, charts by month/week, CSV import/export,
backup/restore, alarms.
3. Weekly/monthly trend charts
Can be implemented using JFreeChart’s line chart with grouped
data.
4. Authentication
Add hashed password login form, role management, encrypted
profile files.
5. API integration
With bank APIs (e.g. Plaid), or SMS parsing to auto-import expenses.
Requires secure token handling.
11. Presentation-Specific Questions
1. Explain screenshot
Describe GUI layout, input flow, table columns, data, chart or PDF
pop-up shown.
2. Reason for including slide
Visual evidence of a working app — demonstrates functional
completion.
3. Feature demo (chart/PDF/undo)
Walk through UI: add expense → undo pops it off the stack → show
chart/pop-up → export PDF saves file.
4. Challenges faced
e.g., handling external JAR imports, layout misalignment, file not
found errors.
5. Personal learnings
UI design, external library integration, debugging skills, serialization,
date handling.
12. Viva-Style Tricky Questions
1. HashMap vs TreeMap
HashMap: unsorted, constant-time. TreeMap: sorted, O(log n).
2. ArrayList vs LinkedList
ArrayList: random access, slower insert/remove; LinkedList: fast
insert/remove, slow random access.
3. JFrame inside another JFrame?
Not recommended. Better to use JDialog or embedded JPanels.
4. GridLayout vs BorderLayout
GridLayout divides space equally; BorderLayout sections
top/bottom/center.
5. Design patterns used
Observer pattern (with ActionListeners), Factory pattern in chart
creation.
6. Making the app multi-threaded
Use background threads (SwingWorker) for blocking tasks (e.g., PDF
export) to avoid freezing UI.
7. Excel import
Use Apache POI library to read .xlsx files, parse rows into
ExpenseEntry, add to profiles.