Header Ads

[OOP] Stock market application



Xây dựng hệ thống quản lý cổ phiếu với các yêu cầu sau:

  • The application should allow the user to select which stocks to display.
    The application should have a StockData class that keeps track of the current prices of several stocks.
  • The StockData class should generate random prices for each stock when its price information changes, and notify all its registered observers.
  • The application should have a StockDisplay class that implements the Observer interface and displays the current prices of the selected stocks.
  • The StockDisplay class should register itself as an observer of the StockData class and update its display when the stock prices change.
  • The application should have a PortfolioDisplay class that implements the Observer interface and displays the current value of the user's stock portfolio, based on the selected stocks and their prices.
  • The PortfolioDisplay class should have a method that allows the user to enter the number of shares they own for each stock.
  • The PortfolioDisplay class should keep track of the total value of the user's stock portfolio, based on the selected stocks and their prices.
  • The PortfolioDisplay class should register itself as an observer of the StockData class and update its display when the stock prices change.
  • The user interface should display the current value of the user's stock portfolio, as well as the current prices of the selected stocks.
  • The user interface should allow the user to enter the number of shares they own for each stock, as well as add or remove stocks from their portfolio.
  • The user interface should update in real-time as the user interacts with the application and as the stock prices change.

Some use cases you need to implement in the app:

  • John is an investor who wants to keep track of his portfolio of stocks. He opens the application and selects the stocks he owns. The StockDisplay class displays the current prices of the selected stocks. John also enters the number of shares he owns for each stock into the PortfolioDisplay class. The PortfolioDisplay class calculates the current value of John's stock portfolio and displays it in the user interface. John can see the real-time changes in the value of his portfolio as the stock prices change.
  • Emily is a stock trader who wants to monitor the market. She opens the application and selects several stocks to display. The StockDisplay class displays the current prices of the selected stocks. Emily can see how the stock prices are changing in real-time and make trading decisions based on that information.
  • Mark is a financial analyst who needs to track the performance of certain stocks. He opens the application and selects the stocks he wants to monitor. The StockDisplay class displays the current prices of the selected stocks. Mark also enters the number of shares he is interested in for each stock into the PortfolioDisplay class. The PortfolioDisplay class calculates the current value of the selected stocks and displays it in the user interface. Mark can analyze the performance of the stocks he is interested in and make recommendations based on that information.
  • Sarah is a novice investor who wants to learn about the stock market. She opens the application and selects a few stocks to display. The StockDisplay class displays the current prices of the selected stocks. Sarah also enters the number of shares she would like to own for each stock into the PortfolioDisplay class. The PortfolioDisplay class calculates the current value of Sarah's hypothetical stock portfolio and displays it in the user interface. Sarah can learn about the stock market and practice making investment decisions with the help of the application.


Không có nhận xét nào

Được tạo bởi Blogger.