Main » Articles » Computer Science » 2014

Table of Values
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);
 
Category: 2014 | Added by: Jerry (10/10/2011)
Views: 244 | Rating: 0.0/0
Total comments: 0
Only registered users can add comments.
[ Registration | Login ]
Section categories
2014 [20]
2013 [57]
Statistics
Map
Login form