java - I am getting a not a statement error -
i need figuring out doing wrong. here coding far. trying plot coordinates on circle. not statement error.
public class mathclass { public static void main (string [] args) { double y1; double y2; system.out.println("points on circle of radius 1.0"); system.out.printf ( "%6s" , "x1", "y1", "x1" , "y2"); system.out.println ("----------------------------------"); (double x1 = 1.00; x1> -1.10; x1 + -0.10) { double x1sq= math.pow(x1,2); double r = 1; double y1sq = r- x1sq; y1= math.sqrt(y1sq); system.out.printf( "%.2f", x1, " ", y1); } }
your problem on line 10 of code posted. issue x1 + -0.10
expression, not statement (hence "not statement" error you're getting). want x1 += -0.10
instead. or, more clear it, use -=
instead of adding negative, whole loop condition looks this:
for (double x1 = 1.00; x1 > -1.10; x1 -= 0.10) { ... }
Comments
Post a Comment