You have defined your
as taking an input parameter of a double value, and returning another double value. But when you call it in the
method, you do not pass it any value, or capture its return. also, you are trying to convert three different text strings to double values, but you store each one in the same variable, thus losing the first two. You also ignore any errors which may occur if the text dstrings are not valid numbers. You need to rework your code and think exactly what each step is required to accomplish. For example, in the
method, you need to validate each input, and take some action if it is not a valid number, or outside some minimum and maximum range. You also need to store it in the correct variable read for the calculation. And your calculate method would be better defined thus:
public double Calculate(double mass, double height, double gravity)
double potentialEnergy = mass * gravity * height;
And unless you are calculating for different planets (or you are a real geek), the gravity value should be a constant.