StaffCoder
Java
Javajava 27
3 modules · 12 challengesSign up
Modules3 modules · 12 challenges
Module 2 of 3 · 4 challenges

Java Objects & Errors

Learn how to design your own types in Java and handle errors: records that check their data, enums for statuses, classes that protect their data, and exceptions.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

Tracking Numbers

Sign up to unlock
100%1 of 1 solvedeasy
About this challenge

Make a tracking number that cannot exist in a bad state: a record that checks its country and number, reads text like DE-004211 with a flexible constructor, prints itself back the same way, and checks text without throwing.

Solved in a browser IDE and graded by tests. Sign up to solve

Parcel Status

Sign up to unlock
—No data yeteasy
About this challenge

Model a parcel's journey as an enum: readable labels, final statuses, the moves each status allows, refused jumps, and a count of every status in declaration order.

Solved in a browser IDE and graded by tests. Sign up to solve

Customer Accounts

Sign up to unlock
—No data yeteasy
About this challenge

Keep business accounts inside their credit limit: an interface with a default method, a class whose balance only changes through its methods, a checked exception that says how far over a charge went, and an Optional lookup by id.

Solved in a browser IDE and graded by tests. Sign up to solve

Tracking Desk

STAR
Solving it completes the module
100%1 of 1 solvedeasy
About this challenge

Replay a day of scans at the tracking desk, writing every piece yourself: tracking numbers that clean and check themselves, statuses that allow only legal moves, accounts that stay within their credit limit, and a desk that lists every failure with its line number.

Solved in a browser IDE and graded by tests. Sign up to solve

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.