Skip to main content

Practice · 1 of 1

Parse the ledger line

CHALLENGE
Difficulty: intermediate+25 XP

Implement parse(String line) in the provided skeleton: split on | into exactly 4 fields; return new Transaction(date, label, Direction.valueOf(field.toUpperCase()), Double.parseDouble(amount)). The record's compact constructor already validates - let its exceptions propagate unchanged (callers need the real reason).

Back to lesson: Practice: Practice: Parse the Ledger