Class Stock

java.lang.Object
  extended by Stock

public class Stock
extends java.lang.Object


Constructor Summary
Stock(java.lang.String name, double price)
          Creates a stock with the given name and price per share.
 
Method Summary
 java.lang.String getName()
          Returns the stock name.
 double getPrice()
          Returns the price per share.
 void setPrice(double price)
          Sets the price per share.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Stock

public Stock(java.lang.String name,
             double price)
Creates a stock with the given name and price per share.

Parameters:
name - Stock name
price - Price per share
Method Detail

getName

public java.lang.String getName()
Returns the stock name.

Returns:
Stock name

getPrice

public double getPrice()
Returns the price per share.

Returns:
Price per share

setPrice

public void setPrice(double price)
Sets the price per share.

Parameters:
price - New price per share

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
String representation of the object.