I wrote an android app that solves quadratic equations and then is supposed to graph them. The library I am using requires the data sets to be in ArrayList form. However the loop I have to create the array involves adding a double to them which you cannot do with array lists. Here is the code:
List<double[]> x = new ArrayList<double[]>();
List<double[]> values = new ArrayList<double[]>();
QuadraticActivity c = new QuadraticActivity();
x=(c.xValueArr);
values=(c.yValueArr);
for (; c.xCurrent <= c.xEnd; c.xCurrent += c.xStep) {
double yCurrent = (c.a)*Math.pow(c.xCurrent, 2) + (c.b)*c.xCurrent + (c.c);
c. xValueArr .add ((c.xCurrent));
c. yValueArr .add ((yCurrent));
line 3to the first line and replacing the twonew ArrayList..statements with the statements in lines 6 & 7. Your code should look like this:QuadtraticActivity c = new QuadraticActivity(); List<Double> x = c.xValueArr; List<Double> values = c.yValueArr;cause theArrayLists that you created with new are just replaced inlines 6 & 7.