Skip to main content

Practice · 3 of 4

Shipment with enum + record

CHALLENGE
Difficulty: beginner+25 XP

Implement in Solution: enum Carrier { Air, Sea, Ground } with a method static int Days(Carrier c) returning 1, 5, 3 respectively (unknown/undefined carrier values throw ArgumentException), and record Shipment(string Id, Carrier Via) plus static Carrier Fastest(Carrier a, Carrier b) returning whichever has fewer Days.

Back to lesson: Practice: Data modeling workout