Design a class named Stock that contains: A string data field named symbol for the stock's symbol.
Fantastic news! We've Found the answer you've been seeking!
Question:
Design a class named Stock that contains:
- A string data field named symbol for the stock's symbol.
- A string data field named name for the stock's name.
- A double field named a previous closing price that stores the stock price for the previous day.
- A double data field named a current price that stores the stock price for the current time.
- A constructor that creates a stock with a specified symbol and name.
- A method named getChangePercent() that returns the percentage changed from previous closing price to currentPrice.
Draw the UML diagram for the class. Implement the class. Write a test program that creates a Stock object with the stock symbol JAVA, the name Sun Microsystems Inc, and the previous closing price of 4.5. Set a new current price to 4.35
Related Book For
Posted Date: