Thread: Stocks.
View Single Post
  #3 (permalink)  
Old 12-03-2007, 10:30 PM
Alex89 Alex89 is offline
Member
 
Join Date: Nov 2007
Posts: 4
Alex89 is on a distinguished road
I hav to create a class named Stock to model a stock on the stock market. The properties and methods of the class are shown below. The method changePercent computes the percentage of the change between the current price and the previous closing price.

2. Write a client program to test the stock class. In the client program, create a Stock object and test it.


Stock UML

-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
+changePercentage(): double

I hope this helps.
Reply With Quote