Question: Q 1. Write the implementation java code for a class named Stock that contains: A string data field named symbol for the stocks symbol. A

Q 1. Write the implementation java code for a class named Stock that contains:

  1. A string data field named symbol for the stocks symbol.
  2. A string data field named name for the stocks name.
  3. A double data field named previousClosingPrice that stores the stock price for the previous day.
  4. A double data field named currentPrice that stores the stock price for the current time.
  5. An integer data field named ID that stores the identifier number of stock.
  6. A constructor that creates a stock with the specified symbol, name, and ID.
  7. A method named getChangePercent() that returns the percentage changed from previousClosingPrice to currentPrice.

double getChangePercent(){

return 100 * (currentPrice - previousClosingPrice) / previousClosingPrice;

}

Q 2. Draw the UML diagram for the class Stock

please draw the UML diagram for the class stock

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!