473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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

3
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.lang.String,double,dou ble)
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:
Expand|Select|Wrap|Line Numbers
  1.  
  2. import static java.lang.System.out;
  3.  
  4. /*Overload Constructors
  5.  
  6.     Stock(symbol,stockName)
  7.     Stock(symbol,stockName,oldPrice,curPrice)
  8.  
  9. */
  10.  
  11. public class StockProg
  12. {
  13.     public static void main(String[] args)
  14.     {
  15.  
  16.         Stock mystock = new Stock("Esi", "ITT", 60.0, 65.0);
  17.  
  18.         //Stock jordan = new Stock("Esi","dsfa",56.2,23.3);
  19.  
  20.         out.println("Symbol: " + mystock.getSym());
  21.         out.println("Name: " + mystock.getName());
  22.         out.println("Previous Closing Price: " + mystock.getPrePrice());
  23.         out.println("Current Price: " + mystock.getCurPrice());
  24.         out.println("Price Change: " + mystock.changePercent());    
  25.     }
  26.  
  27. }
  28.  
  29. class Stock
  30. {
  31.     private String symbol;
  32.     private String stockName;
  33.     private double previousClosingPrice;
  34.     private double currentPrice;
  35.  
  36.  
  37. //constructor    
  38.     public void Stock(String sym, String name)
  39.     {
  40.         this.symbol = sym;
  41.         this.stockName = name;
  42.     }
  43.  
  44.     public void Stock(String sym, String name, double oldPrice, double curPrice)
  45.     {
  46.         this.symbol = sym;
  47.         this.stockName = name;
  48.         this.previousClosingPrice = oldPrice;
  49.         this.currentPrice = curPrice;    
  50.     }
  51.  
  52.     public void Stock()
  53.     {}
  54.  
  55. //constuctor end
  56.  
  57. //accesser methods begin here
  58.     public String getSym()
  59.     {
  60.         return this.symbol;
  61.     }
  62.  
  63.     public String getName()
  64.     {
  65.         return this.stockName;
  66.     }
  67.  
  68.     public double getPrePrice()
  69.     {
  70.         return this.previousClosingPrice;
  71.     }    
  72.  
  73.     public double getCurPrice()
  74.     {
  75.         return this.currentPrice;
  76.     }    
  77. //end of accesser methods
  78.  
  79. //mutator methods start
  80.  
  81.     public void setClosingPrice(double price)
  82.     {
  83.         this.previousClosingPrice = price;
  84.     }
  85.  
  86.     public void setCurrentPrice(double price)
  87.     {
  88.         this.currentPrice = price;
  89.     }
  90. // end of mutator methods
  91.  
  92.     public double changePercent()
  93.     {
  94.         return (this.currentPrice / previousClosingPrice * 100) - 100;
  95.     }
  96. }
  97.  
  98.  
  99.  
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.
Oct 11 '11 #1
0 1633

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Michael Twua | last post by:
In asp.net with vb.net,I can't create a excel object,such as excel.application,excel.workBook,excel.workSheet. It displayed that "System.UnauthorizedAccessException Refuse Access". I have import...
5
by: touf | last post by:
Hi, I'm having this error when I try to open a report (Crystal reports) on the client machine (It works fine on my developpement machine) It's a window application (not a web), On the client...
15
by: Bjorn Jensen | last post by:
Hi! An beginner question: Pleas help me with this (-: Error (the arrow points on the s in sqrt) ===== tal.java:6: cannot find symbol symbol : method sqrt(int) location: class tal...
7
by: musclemilk | last post by:
Good day, now i know that someone was having the same error message and i read the thread but didnt help me out too much! so basically i have a command button that on a form that needs to open...
4
by: ramaswamynanda | last post by:
Hello All, I have developed an application using Ms Access 2000. My client has Access 2003. I shipped him the code yesterday and he got an error hile running the application via the mdb file...
1
by: Zhuo Li | last post by:
I am using VS2005. The "Edit|Find and replace" dialog won't pop up when you try to find something (tried short cuts like: CTRL-F too, no luck). Does anybody know how to bring this dialog back. ...
11
by: dowlingm815 | last post by:
the following code is generating an error; Mircosoft Access cant find the field '|" referred to in your expression" any suggestions would be appreciated. Private Sub...
0
by: etri | last post by:
import TurtleGraphics.*; public class Square { private Turtle yertle; public Square() { yertle = new Turtle (TGCanvas(700,40)); //yertle.penDown(); yertle.forward(40); //yertle.penUp();
6
by: neelsfer | last post by:
I have a combobox in a form that looks up records based on this form itself(cyclist tbl).I also add new records to this same form if i cant find the IDNo of a person in this combobox. If i type in...
1
by: matthew brown | last post by:
class Temperature{ // Convert temperature from Fahrenheit to Centigrade //Author : Samuel N. Kamin, June 1 , 1996 public static void main(Stringargs) { int temperature; //The Fahrenheit...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.