Modifying Map Values
Your performPurchase function does not currently charge patrons for their orders, which is an unsustainable business model for Taernyl. To perform a transaction, the price of the item should be deducted from the patron’s purse and added to Taernyl’s. The patronGold map associates gold balance values with a given patron’s name as a key. You will modify the gold balance value for a patron to record the patron’s new balance once the purchase is completed.
For now, Taernyl will use a fixed-pricing model, where every item costs the same amount. After you start charging your patrons, you will come back and use the prices in tavern-menu-data.txt instead.
Update performPurchase to use the patronGold map to track the flow ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access