Search⌘ K

Challenge: Observer Pattern

Explore how to implement the observer pattern by creating an auction system with Auctioneer and Bidder classes. Learn to manage bidder registration, price announcements, and notifications to simulate real-time bidding and determine the winning bid.

Problem statement

In this challenge, you have to implement an auction system using the observer pattern.

You have two classes Auctioneer (the person conducting the bid) and Bidder (the bidder bidding for the object).

Here’s what the Auctioneer class needs to do:

  • It should maintain a list of all bidders.

  • It should have a function registerBidder ...