Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Stock class with parameters symbol name previousclosingprice current...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started