Write a class named Stock to model a stock. The properties and methods of the class are shown in Figure 6.22. The metho changePercent computes the percentage of the change in the current vs. the previous closing price.
Write a client program to test the Stock class. In the client program, create a Stock object with stock symbol SUNW, name Sun Microsystems Inc, previous closing price of 100. Set a new current price randomly and display the price change percentage.
Table: Figure 6.22
-symbol:String
-name:String
-previousClosingPrice:double
-currentPrice:double
+Stock()
+Stock(symbol:String, name:String)
+getSymbol():String
+getName():String
+getPreviousClosingPrice():double
+getCurrentPrice():double
+setSymbol(symbol:String):void
+setName(name:String):void
+setPreviousClosingPrice(price:double):void
+setCurrentprice(price:double):void
+changePercent(newPercent: double): double