You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed two expression evaluator bugs that caused Bubble Sort to produce unsorted output and Array Sum to show wrong average.
182
+
183
+
-**Bug 1 — Chained subtraction:**`n - i - 1` returned `undefined` because `splitOnOperator(expr, '-')` produced 3 parts but the handler only accepted exactly 2 (`parts.length === 2`). The inner for loop condition `j < n - i - 1` was always `false`, so the swap code never executed. Fix: subtraction handler now processes any number of parts left-to-right using a loop
184
+
-**Bug 2 — Type cast precedence:**`(double) sum / numbers.length` was parsed as `(double) (sum / numbers.length)` — integer division happened first (`21 / 5 = 4`), then the cast (`4.0`). Average showed `4` instead of `4.2`, and the conditional incorrectly printed "Below threshold." Fix: cast handler now detects arithmetic operators after the cast target and applies the cast to only the first operand before performing the operation (`21.0 / 5 = 4.2`)
185
+
- All 8 built-in examples verified working after fixes
186
+
187
+
---
188
+
189
+
### v14.0 (Final) — Example Programs Renamed with Descriptive Class Names
190
+
**Lines:**~2,928 | **Date:** May 28, 2026
191
+
192
+
Replaced `public class Main` in all 8 built-in example programs with descriptive class names.
193
+
194
+
-**ArraySumAverage** — Array Sum & Average
195
+
-**BubbleSort** — Bubble Sort
196
+
-**Fibonacci** — Fibonacci (Recursive)
197
+
-**Factorial** — Factorial (Recursive)
198
+
-**BinarySearch** — Binary Search
199
+
-**StringReversal** — String Reversal
200
+
-**FizzBuzz** — FizzBuzz
201
+
-**SelectionSort** — Selection Sort
202
+
- File label now shows `BubbleSort.java`, `Fibonacci.java`, etc. instead of `Main.java`
0 commit comments