Today's assignment - creating a Table of Values for a calculation, like the following:
Searching for the smallest value of Y = (x-4)(4x+1)
X
| ... Y = (x-4)(4x + 1)
| -5 -4 -3 -2 -1 0 1 2 3 4 5
| 171 120 77 42 15 -4 -15 -18 -13 0 21
|
System.out.println("X \t Y");
double x , y;
x = inputDouble("X");
y = (x-4)*(4*x+1);
System.out.println(x + "\t" + y);
x = x + 1;
y = (x-4)*(4*x+1);
System.out.println(x + "\t" + y);
x = x + 1;
y = (x-4)*(4*x+1);
System.out.println(x + "\t" + y);
x = x + 1;
y = (x-4)*(4*x+1);
System.out.println(x + "\t" + y);
x = x + 1;
y = (x-4)*(4*x+1);
System.out.println(x + "\t" + y);
x = x + 1;
y = (x-4)*(4*x+1);
System.out.println(x + "\t" + y);
x = x + 1;
y = (x-4)*(4*x+1);
System.out.println(x + "\t" + y);
x = x + 1;
y = (x-4)*(4*x+1);
System.out.println(x + "\t" + y);
x = x + 1;
y = (x-4)*(4*x+1);
System.out.println(x + "\t" + y);
x = x + 1;
y = (x-4)*(4*x+1);
System.out.println(x + "\t" + y);
x = x + 1;
y = (x-4)*(4*x+1);
System.out.println(x + "\t" + y);
|