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
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
Step by Step Solution
3.37 Rating (141 Votes )
There are 3 Steps involved in it
To design the Stock class as described and to write a test program well follow these steps Step 1 Draw the UML Diagram plaintext Stock symbol String n... View full answer
Get step-by-step solutions from verified subject matter experts
