Okay, I am trying write the function y = c + bx + cx^2 in java with the capability of calling it the main method. This is what I have so far:
public double poly(double c, double b, double a, double x)
{
y = c + b*x + a*x*x;
return y;
}
and here is what I type in the main method:
public static void main(String[] args)
{
System.out.println(poly(2,2,2,2));
}
The error I get is
non-static method poly(double,double,double,double) cannot be referenced from a static context.
How can I fix this? I am just trying to evaluate the function and print out the result.