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:
- A string data field named symbol for the stocks symbol.
- A string data field named name for the stocks name.
- A double data field named previousClosingPrice that stores the stock price for the previous day.
- A double data field named currentPrice that stores the stock price for the current time.
- An integer data field named ID that stores the identifier number of stock.
- A constructor that creates a stock with the specified symbol, name, and ID.
- 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
Get step-by-step solutions from verified subject matter experts
