Meaningless Drivel is fun!
The moose likes Beginning Java and the fly likes connot resolve symbol-variable calculate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "connot resolve symbol-variable calculate" Watch "connot resolve symbol-variable calculate" New topic

connot resolve symbol-variable calculate

Valarie Brandt

Joined: Oct 03, 2003
Posts: 24
i am getting the above error message when i try to compile. calculate is not a variable it is a method but invoiceDate is a method also so i don't see where i went wrong any help that can be offered would be appreciated.
(invoice method which works fine)
public void invoiceDate()
invoiceDate = new Date();
SimpleDateFormat formatter = new SimpleDateFormat();
String dateString = formatter.format(invoiceDate);

public double calculate()
double calculate;
calculate = quantity * price;
return calculate;
public void display()
System.out.println("The invoice date is: "+ invoiceDate +
"\nItem Name: " + name + "\nQuantity: " +quantity +
"\nPrice per item is : " + price + "\nThe total price is: "
+ calculate + ".");
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Here there's a method named invoiceDate() that uses a variable named invoiceDate,. This method assigns a value to a variable "invoiceDate" in the first line, but I don't see a declaration for that variable; it would be OK it if were a member, but if not, then you need to say "Date invoiceDate = ..."

This method is fine if quantity and price are member variables; otherwise, it's going to have the same problems.

This method refers to variables named invoiceDate and calculate; I strongly suspect you mean to call the functions invoiceDate() and calculate() here instead like


[Jess in Action][AskingGoodQuestions]
Valarie Brandt

Joined: Oct 03, 2003
Posts: 24
thank you so much--You helped me realize that i needed to call the method name and the method name includes the () right?
thank you

I agree. Here's the link:
subject: connot resolve symbol-variable calculate
It's not a secret anymore!