Problem with my class, "cant find symbol on my constructor"?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Noah J
    New Member
    • Apr 2011
    • 3

    Problem with my class, "cant find symbol on my constructor"?

    I need help with this error that i keep getting when i run my program.

    the error is the following:


    StockProg.java: 15: cannot find symbol
    symbol : constructor Stock(java.lang .String,java.la ng.String,doubl e,double)
    location: class Stock
    Stock mystock = new Stock("wall", "street", 60.0, 65.0);
    ^
    1 error


    When I press the preview button to see how this is going to look, it puts the identification arrow under Stock, but it is really supposed to be under the n in "new".

    Here is my code:
    Code:
    import static java.lang.System.out;
    
    /*Overload Constructors
    
    	Stock(symbol,stockName)
    	Stock(symbol,stockName,oldPrice,curPrice)
    
    */
    
    public class StockProg
    {
    	public static void main(String[] args)
    	{
    		
    		Stock mystock = new Stock("Esi", "ITT", 60.0, 65.0);
    		
    		//Stock jordan = new Stock("Esi","dsfa",56.2,23.3);
    		
    		out.println("Symbol: " + mystock.getSym());
    		out.println("Name: " + mystock.getName());
    		out.println("Previous Closing Price: " + mystock.getPrePrice());
    		out.println("Current Price: " + mystock.getCurPrice());
    		out.println("Price Change: " + mystock.changePercent());	
    	}
    
    }
    
    class Stock
    {
    	private String symbol;
    	private String stockName;
    	private double previousClosingPrice;
    	private double currentPrice;
    
    
    //constructor	
    	public void Stock(String sym, String name)
    	{
    		this.symbol = sym;
    		this.stockName = name;
    	}
    
    	public void Stock(String sym, String name, double oldPrice, double curPrice)
    	{
    		this.symbol = sym;
    		this.stockName = name;
    		this.previousClosingPrice = oldPrice;
    		this.currentPrice = curPrice;	
    	}
    	
    	public void Stock()
    	{}
    	
    //constuctor end
    
    //accesser methods begin here
    	public String getSym()
    	{
    		return this.symbol;
    	}
    
    	public String getName()
    	{
    		return this.stockName;
    	}
    
    	public double getPrePrice()
    	{
    		return this.previousClosingPrice;
    	}	
    
    	public double getCurPrice()
    	{
    		return this.currentPrice;
    	}	
    //end of accesser methods
    
    //mutator methods start
    
    	public void setClosingPrice(double price)
    	{
    		this.previousClosingPrice = price;
    	}
    
    	public void setCurrentPrice(double price)
    	{
    		this.currentPrice = price;
    	}
    // end of mutator methods
    
    	public double changePercent()
    	{
    		return (this.currentPrice / previousClosingPrice * 100) - 100;
    	}
    }
    I keep going at this at different angles, but I cant get past this error. I don't have class until next week and I really want to move on to writing more code, but I cant until i get past this error.
Working...