Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Checkpoint โ€” Data models

โญ beginnerโณ 20 min read๐Ÿ“ Lesson 45 of 85

A catalog of products: an enum category, a record line item with value equality, and aggregation over a list.

Checkpoint: the product catalog

Task: implement in Solution:

  1. enum Category { Books, Electronics, Food }
  2. record Item(string Name, Category Cat, decimal Price)
  3. static decimal Total(List<Item> items, Category cat) โ€” sum of prices for items in exactly that category; null/empty list or no matches โ†’ 0.
  4. static Item? MostExpensive(List<Item> items) โ€” the item with the highest price; null/empty โ†’ null. Ties: return any one.