Skip to main content

Practice ยท 1 of 4

Validate with reasons

CHALLENGE
Difficulty: beginner+25 XP

Implement static AddResult Validate(Transaction t) โ€” reject when Amount <= 0 ("amount-must-be-positive"), when Category is null/whitespace ("category-required"), or when Description exceeds 100 characters ("description-too-long"); otherwise Ok with Error null.

Back to lesson: Practice: Capstone workshop