Skip to main content
๐Ÿ“œ WAYPOINT LESSON

Checkpoint: ShoppingCart

โญโญ intermediateโณ 30 min read๐Ÿ“ Lesson 116 of 256

A full class from a spec table โ€” state, memory field, guarded undo.

Three fields (total, itemCount, lastPrice), a constructor, two mutators with a guard, two readers โ€” the exact anatomy of an exam Class Design FRQ. The insight being graded: refundLast needs MEMORY (the last price), which is a state decision, not a syntax decision. When the spec table is silent about a case, the guard is your answer (empty cart โ†’ false, nothing changes).