Skip to main content

Practice ยท 3 of 3

Debug: The Discount That Pays Customers

CHALLENGE
Difficulty: intermediate+25 XP

A checkout bug report: one customer paid 50 for a 150%-off coupon and the balance went NEGATIVE. Fix ApplyDiscount so percent is clamped to [0, 100] before use. CountNonEmpty is correct โ€” leave it alone. ``csharp static void ApplyDiscount(ref decimal price, decimal percent); static int CountNonEmpty(params string?[] items); ``

Back to lesson: Practice: Parameter Passing Practice