Assignment 2 - Specification
Assignment 2 - Specification
Assignment 2
Real-time Stock Monitoring System
Objective
Design and implement a system that simulates real-time stock monitoring, providing
users with up-to-date stock information from multiple sources in a customizable
display. The system should demonstrate the use of the Observer, Adapter, and
Singleton design patterns.
Description
The Real-time Stock Monitoring System enables users to track current stock prices,
ensuring they have the latest market data for informed decision-making. By
aggregating data from multiple sources, such as the HOSE and HNX exchanges, the
system provides a comprehensive view of the market.
Core Components
You are given a class diagram as presented in the Appendix.
The main components of the system are:
- Stock: Represents a stock, including stock code and name.
- StockPrice: Represents a stock price update, including attributes such as
stock, average price, timestamp, and volume, which store the average price
and total matched volume within one minute.
- StockFeeder: Manages stock prices and notifies registered observers when
prices change.
o addStock(Stock stock): Adds a stock to the monitoring list.
o registerViewer(String code, StockViewer
stockViewer): Registers a new observer.
o unregisterViewer(String code, StockViewer
stockViewer): Unregisters an observer.
o notify(StockPrice stockPrice): Notifies all registered
observers about stock price changes.
Vietnam National University, Ho Chi Minh City
Ho Chi Minh City University of Technology
268 Ly Thuong Kiet Street, District 10, Ho Chi Minh City, Viet Nam
- Note: System must use class Logger to print messages to the console.
Student Tasks
Your task is to implement the system and ensure all required components function
correctly. You must implement all yellow-colored classes in the class diagram.
Note: The class diagram does not show basic methods such as getters, setters, and
overridden functions. Additionally, to simplify the diagram, some methods have been
omitted, but you can find more details in the provided code.
Vietnam National University, Ho Chi Minh City
Ho Chi Minh City University of Technology
268 Ly Thuong Kiet Street, District 10, Ho Chi Minh City, Viet Nam
Appendix
Initial Class Diagram
Yellow parts are classes that you must implement. These classes are fixed as the
diagram in Figure 1.
Guidance: In order to run the project, please follow README.md in the folder Initial
Code.
Submission Instructions:
• You will complete the assignment individually and must submit the code as a
ZIP file via LMS.
• Before submitting, rename the folder Initial Code using the following format:
StudentName_StudentID
o Example: NguyenVanA_1952968
• Compatibility Test: You will be provided with some simple test cases to check
the compatibility of your submission on April 1, 2025.
Important Notes:
• Ensure that your submission folder follows Maven’s standard structure1.
https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html.
Last accessed on 08:00, March 18, 2025.
Vietnam National University, Ho Chi Minh City
Ho Chi Minh City University of Technology
268 Ly Thuong Kiet Street, District 10, Ho Chi Minh City, Viet Nam
Example:
o A student passes 95/100 test cases.
o In the final exam, they correctly answer 5/10 questions related to the
assignment 2.
o Their final assignment 2 score = 95 × (5/10) = 47.5.