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: -
-
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.
0 1633 Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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.
...
|
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...
|
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();
|
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...
|
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...
|
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,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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$) {
}
...
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
| | |