The brief. Predicting nets is one thing; writing the cession that produces them is the job. Below is the 2025 loss book with a target net on every row, and an empty
Cedefunction. Alpina has bought three facultative certificates — C3 cedes 60, C4 cedes 100, C5 cedes 200 — and retains everything else, including the attritional bulk. FillCedeso the whole check battery goes green. The stub cedes nothing, so it ships red.
This is Lesson 1's sign rule at working size — one step past Predict the Net: there you read the arithmetic, here you author it. The battery does not just check each claim — it checks the individual net total and the book net total, so a wrong sign or a stray cession on the attritional row shows up immediately.
The rules
- Ceded is negative.
Cede(claim)returns the ceded amount for a claim — a negative number for the three certificates,0for every retained claim.net = gross + Cede(claim); you write no subtraction. - The certificates: C3 → cede 60, C4 → cede 100, C5 → cede 200. Nothing else is ceded.
- The attritional row is off-limits.
ATTis a bulk amount, not an individual claim — a per-claim certificate cannot touch it. Its net must stay 350. - Drive all seven rows and both total lines to ✓.
Your workbench
using MeshWeaver.Layout;
using MeshWeaver.Layout.Composition;
using MeshWeaver.Layout.DataGrid;
using MeshWeaver.Utils;
// YOUR CESSION — implement it so the whole battery below goes green.
// Alpina buys three facultative certificates, one per large claim:
// C3 cedes 60 · C4 cedes 100 · C5 cedes 200 · everything else is retained in full.
// Ceded is stored NEGATIVE; net = gross + Cede(claim). Return 0 for a retained claim.
static double Cede(string claim)
=> 0.0; // TODO: return the NEGATIVE ceded amount for C3, C4, C5 — and 0 for the rest.
record Row(string Claim, double Gross, double Ceded, double Net, double Expected, string Result);
// The canonical 2025 loss book, with the net each row MUST reach once the certificates apply.
// (Claim, Kind, Gross, Expected net)
(string Claim, string Kind, double Gross, double Expected)[] book =
[
("C1", "Individual", 80, 80),
("C2", "Individual", 240, 240),
("C3", "Individual", 420, 360),
("C4", "Individual", 760, 660),
("C5", "Individual", 1300, 1100),
("C6", "Individual", 90, 90),
("ATT", "Attritional", 350, 350),
];
var rows = book.Select(c =>
{
var ceded = Cede(c.Claim);
var net = c.Gross + ceded;
var ok = Math.Abs(net - c.Expected) < 1e-9;
return new Row(c.Claim, c.Gross, ceded, net, c.Expected, ok ? "✓" : "✗");
}).ToArray();
var green = rows.Count(r => r.Result.StartsWith("✓"));
var indivNet = rows.Where(r => r.Claim != "ATT").Sum(r => r.Net);
var bookNet = rows.Sum(r => r.Net);
var indivOk = Math.Abs(indivNet - 2530) < 1e-9;
var bookOk = Math.Abs(bookNet - 2880) < 1e-9;
Controls.Stack
.WithView(Controls.H4($"Cession battery — {green}/{rows.Length} rows green"))
.WithView(Controls.DataGrid(rows)
.WithColumn(new PropertyColumnControl<string> { Property = nameof(Row.Claim).ToCamelCase() }.WithTitle("Claim"))
.WithColumn(new PropertyColumnControl<double> { Property = nameof(Row.Gross).ToCamelCase() }.WithTitle("Gross").WithFormat("N0").WithAlign("end"))
.WithColumn(new PropertyColumnControl<double> { Property = nameof(Row.Ceded).ToCamelCase() }.WithTitle("Ceded").WithFormat("N0").WithAlign("end"))
.WithColumn(new PropertyColumnControl<double> { Property = nameof(Row.Net).ToCamelCase() }.WithTitle("Net").WithFormat("N0").WithAlign("end"))
.WithColumn(new PropertyColumnControl<double> { Property = nameof(Row.Expected).ToCamelCase() }.WithTitle("Must be").WithFormat("N0").WithAlign("end"))
.WithColumn(new PropertyColumnControl<string> { Property = nameof(Row.Result).ToCamelCase() }.WithTitle("Result"))
.Resizable(false))
.WithView(Controls.Markdown(
$"**Individual net total** {indivNet:N0} (must be 2,530) {(indivOk ? "✓" : "✗")} · **book net total** {bookNet:N0} (must be 2,880) {(bookOk ? "✓" : "✗")}. The attritional 350 is never touched — a certificate cedes an *individual* claim."))
When every row and both totals read ✓, your Cede function is the cession — and the net column fell out of gross + ceded, with no subtraction logic anywhere.
Battery green — or stuck on a sign? Reveal the solution — the three-line Cede and why the attritional row stays put.