Mini Project: Cramer's Calculator
A Java + JavaFX calculator that solves a system of equations via Cramer's Rule, using a recursive cofactor expansion to compute each determinant.
Why it exists
Built independently right after finishing the JavaFX GUI for Building a GUI for a Bookstore Application and a Data Structures & Algorithms course - a self-set challenge to put newly learned recursion and older linear algebra to work on the same problem.
The recursion, worked out
determinant() expands along the top row: each entry is multiplied by the determinant of the smaller matrix left over once that entry's row and column are excluded, with the sign flipping every other term. Below 3x3 it recurses again on each of those minors; at 2x2 it just solves directly.
+a
exclude row 1, col 1
= ei - fh
-b
exclude row 1, col 2
= di - fg
+c
exclude row 1, col 3
= dh - eg
det = a(ei - fh) - b(di - fg) + c(dh - eg)
Cramer's Rule, applied literally
findColDeterminant() computes the coefficient matrix's determinant once. Then, for each variable, it temporarily swaps that variable's column for the equations' result values, recomputes the determinant, divides by the original, and swaps the column back before moving to the next variable - the same matrix reused in place rather than re-cloned each time. If the original determinant is 0, the system has no unique solution, and the calculator surfaces that as an error instead of dividing by zero.
The actual flow
A plain JavaFX GridPane UI, resized on the fly to fit however large a system you set up:
Setup (rows, columns) → Calculator (n×n coefficients + n results)
├─ Solve → Answer screen (Var #1...n)
└─ det = 0 → "invalid/no solutions"
Rows and columns have to match and be positive going in - anything else gets its own dedicated error screen instead of quietly failing.
The README carries its own disclaimer, kept as-is: "These programs have been created to demonstrate my projects. They SHOULD NOT be used during EVALUATIONS and I am NOT responsible for ANY ACADEMIC MISCONDUCT charges landed on someone who uses them."