An e-commerce web site allows users to receive a notification when an out-of-stock item is available for order.

Use the following object model for the system. Add the services using the observer pattern to support notification of clients when an item that is out has been replenished. Think about when the customer interest should be removed from the item. see image.

Build a test class that does the following:

1.Creates the following:

  • Site (name)
    • AAA Web Site
  • 3 Items (number, description, qty)
    • 1, Widget 1, 1
    • 2, Widget 2, 2
  • 3 Customers (name, email)
    • David, david.b.north@gmail.com
    • < your name>, < your email>

2.Execute the following

  • Sell item 1
  • David registers interest in item 1
  • Sell item 2
  • Sell item 2
  • David and you register interest in item 2
  • Add 1 item 1 to inventory
  • Add 1 item 1 to inventory
  • Add 1 item 2 to inventory
  • Add 1 item 2 to inventory

The output (output a line to simulate sending email) should be:

(david.b.north@gmail.com) David, you ask to receive notice when Widget 1 is in inventory.
(david.b.north@gmail.com) David, you ask to receive notice when Widget 2 is in inventory.
(< your email>) < You>, you ask to receive notice when Widget 2 is in inventory.
(david.b.north@gmail.com) David, Widget 1 is now available.
(david.b.north@gmail.com) David, Widget 2 is now available.
(< your email>) < You>, Widget 2 is now available.
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.