The fix is a refusal: the combined ratio exists only when all four components do. This is, almost token for token, what the product's SubmissionMetrics scope ships — the exercise makes you rediscover why.

The metrics

static double Premium100(Pack p) => p.RateOnLine * p.Limit;

static double? CombinedRatio(Pack p)
    => p is { LossRatio: double lr, Brokerage: double b, CedingCommission: double c, ExpenseRatio: double e }
        ? lr + b + c + e
        : null;

The pattern-match is the whole idea: it only deconstructs when every component is a real double, so Léman's missing loss ratio makes the entire expression null. No sentinel zeros, no ?? 0.0 — the absence propagates.

What the numbers say

Live and green

Implement Premium100 and a null-honest CombinedRatio (pattern-match all four components, else null) for the Léman PA XL pack; show all three checks green: premium 195,000, Léman CR null with the Head-of-LoB referral line, control CR 86%.

← Back to the exercise · Lesson 1 — The submission · All solutions

Reconnecting…
The connection to the server was interrupted. Trying to restore it…
Trying again…
The connection could not be restored. Reloading the page…
The server was updated. Reloading the page to pick up the latest version.