A Java modeling tool for investment portfolios. It builds a small object model of people, brokers, assets and portfolios, loads that data from either flat files or a MySQL database, and produces formatted summary and detail reports — total value, weighted risk, projected return, broker fees and commissions per portfolio.
- People —
Person, withBroker(abstract) split intoJuniorBrokerandExpertBroker, each with its own fee and commission schedule (e.g. junior brokers charge a flat $75/asset plus 1.25% commission; expert brokers charge no flat fee but 3.75% commission). - Assets —
Asset(abstract) implemented asStock,Deposit, andPrivateInvestment, each computing its own value, annual return, and risk measure. - Portfolios — a
Portfolioties an owner, a manager, an optional beneficiary, and a list of assets together, and aggregates their totals. - A hand-rolled generic
MyLinkedList<T>(with its own iterator) is used to hold and sort portfolio collections, rather than relying onjava.util.
| Class | Data source | What it does |
|---|---|---|
PortfolioFileReport | Flat files in data/ | Loads portfolios from the .dat files and prints a summary + detail report. No setup required — this is the quickest way to see it run. |
PortfolioReport | MySQL | Loads the same data from a database via JDBC and prints three summary reports sorted by owner, value, and manager. |
DataConverter | Flat files in data/ | Converts the asset and person data into XML (via XStream) and JSON (via Gson). |
Persons.dat and Assets.dat are semicolon-delimited flat files, one record
per line, e.g.:
LU02704JUO6JDTTL4CI5;S;Ailane;2.92;7.56;0.83;THM;209.19
Portfolios.dat references records from both by code. All sample data under
TBFassignment/data/ is synthetically generated — no real people or accounts.
The project has no build tool (Maven/Gradle) — it's a plain javac/IntelliJ
project. Third-party jars (gson, xstream, mysql-connector-java,
xmlpull) are vendored under TBFassignment/lib/.
Easiest path — open in IntelliJ: open TBFassignment/, let it pick up
Phase1.iml, and run PortfolioFileReport (no external services needed).
From the command line, from TBFassignment/:
mkdir -p out
javac -d out -cp "lib/*" src/com/tbf/*.java
java -cp "out;lib/*" com.tbf.PortfolioFileReport(Classpath entries are separated by ; on Windows and : on macOS/Linux.)
Running PortfolioReport (the database-backed report) additionally requires a
MySQL instance matching the schema in
portfolioDB.sql, with connection details
supplied via the FMS_DB_URL, FMS_DB_USER, and FMS_DB_PASSWORD
environment variables (see DatabaseInfo).