Thread: Stocks.
View Single Post
  #4 (permalink)  
Old 12-03-2007, 11:02 PM
Alex89 Alex89 is offline
Member
 
Join Date: Nov 2007
Posts: 4
Alex89 is on a distinguished road
I have created the class for my stock now I need to create a client program to test my class. I need help with the client program.



This is my class for the stock.

public class Stock {

private string symbol;
private string name;
private double previousClosingPrice;
private double currentPrice;

public stock ()
{

symbol = "";
name = "";
previousClosingPrice = 0.0;
currentPrice = 0.0;
}
public stock (String symbola, String namea)
{
this.symbol = symbola;
this.name = namea;
previousClosingPrice = 0.0;
currentPrice = 0.0;
}
public String getSymbol ()
{
return symbol;
}
public String getName ()
{
return name;
}
public double getPreviousClosingPrice () { return previousClosingPrice;}
public double getCurrentPrice () { return currentPrice;}

public void setSymbol (String symbol)
{
this.symbol = Symbol;
}
public void setName (String name) { this.name = Name;}
public void setPreviousClosingPrice (double cost)
{
this.previousClosingPrice = cost;
}
public void setCurrentPrice (double morecost ) {this.currentPrice = morecost}

public double changePercentage ()
{
return currentPrice/previousClosingPrice;
}
}
Reply With Quote