The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 399 Weeks Ago, 1 Day Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
9.2Â Â Â Â Â Â Â Â Â (The Stock class) Following the example of the Circle class in Section 9.2, 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 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.
â– Â Â Â A constructor that creates a stock with the specified symbol and name.
â– Â Â Â A method named getChangePercent() that returns the percentage changed from previousClosingPrice to currentPrice.
Draw the UML diagram for the class and then implement the class. Write a test program that creates a Stock object with the stock symbol ORCL, the name Oracle Corporation, and the previous closing price of 34.5. Set a new current price to 34.35 and display the price-change percentage.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll