You need to create the variable to hold the return of the function call. Here we created "distancevar" and also notice that we DO NOT use the data types when CALLING the function. Data types are only used in parameters when you are defining functions etc.

This should get you compiling and moving on the right path. Enjoy!

"At DIC we be radius calculating code ninjas... I calculate the distance between your left ear and right ear to be -1.42... wait, that can't be right."

The reason you're getting all the errors on line 70 (I think thats the line that calls the distance method within the radius method) is because I think when you call a method from within another, you don't need to declare the input parameter variable types, as they have already been declared.

When you execute the radius method, it will request those input parameters (x1, x2, y1, y2), and they will be stored as instance variables which will then be used as the inputs for the distance method.

If radius is always going to = distance, why not declare a field variable, and set radius = distance?

Re: Lost in calling methods

Posted 23 September 2008 - 07:20 PM

Thank you so much Martyr2, I was trying to fix that for more than an hour and it was such a simple thing lol, thank you so much. I don't even wanna know how much longer I coulda sat their attempting to figure that out. it now compiles perfectly.

Re: Lost in calling methods

Posted 23 September 2008 - 09:35 PM

the methods are never are being called that you have created. you must call the methods that you created from the main method that you have. right now you have, public static void main(String[] args), method. and everything is getting executed from that method, so now you just need to include the calls to the other methods within this method

only the code in the main() method is going to get executed when you start the program. the other methods must be called in order to be executed

Re: Lost in calling methods

Posted 23 September 2008 - 09:51 PM

//variable declaration
double x1;
double x2;
double y1;
double y2;
// double distance; remove this variable (delete this line)
double radius; //add this variable
double circumference; //add this variable
double area; //add this variable
//executable statements
// Prompts for first double and stores value in x1
System.out.print ("Enter the value for the first point on the circle: ");
x1 = console.nextDouble();
System.out.println();
// Prompts for first double and stores value in x2
System.out.print ("Enter the second point on the circle: ");
x2 = console.nextDouble();
System.out.println();
// Prompts for first double and stores value in y1
System.out.print ("Enter the third point on the circle: ");
y1 = console.nextDouble();
System.out.println();
// Prompts for first double and stores value in y2
System.out.print ("Enter the fourth point on the circle: ");
y2 = console.nextDouble();
System.out.println();
//Make the calls to the methods that you created
radius = radius(x1,x2,y1,y2);
circumference = circumference(radius);
area = area(radius);
printarea(radius,area,circumference);

just another quick note...i'm not exactly sure on the math on all this so i can't check you there, but i'm suspicious of the distance and radius method

Re: Lost in calling methods

Posted 24 September 2008 - 04:03 PM

look at the post directly above your last post....i included the calls to all your methods at the very bottom of it (you have to scroll down). i included everything you need in your main method in the first code box above

you do have the correct idea above though...almost there
let me know when you get it or if you have more problems...good luck, you can also IM me if needed

Re: Lost in calling methods

go back to your original code that you had in the printarea method as noted above

the reason it is complaining is because when you defined those variables (x1,x2,y1,y2), you did so in the main method. therefore there scope is only going to be within that method (not recognized outside of it). to allows those variables to be used in the printarea method you would have to pass them in as arguments to the method (as you did with the other variables such as radius, area, and circumference)

i believe you should just go back to your original code for printarea as noted above

p.s. you can remove the following line from your code because it's not being used:
import java.lang.*;