Practice ยท 1 of 2
Be the test suite
The provided average has a real logic bug (integer division truncates). Write main that acts as a test suite: print one line per case, PASS/FAIL name per check, covering (1) average({1,2}) == 1.5, (2) average({5}) == 5.0, (3) average throws IllegalArgumentException for an empty array. Run it, watch case 1 FAIL, then fix average (cast before dividing) so all three print PASS.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Practice: Prove It Works