Im calculating x and y values and I need to put these into Array lists, what im doing wrong?
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
public class Arvutused {
static ArrayList<Double> listx = new ArrayList<Double>();
static ArrayList<Double> listy = new ArrayList<Double>();
public Arvutused() {
double x, y, t = 10.0, samm = 0.1;
while (t >= -10.0) {
t = t - samm;
x = xValue(t);
y = yValue(t);
listx.add(new Double(x));
listy.add(new Double(y));
}
}
/**
* X values calculating.
*
* @return x väärtus
*/
public static double xValue(double t) {
double x = 50.0 * Math.pow(Math.cos(Math.PI * (t / 10.0)), 3);
return x;
}
/**
* Y values.
*
* @return y value
*/
public static double yValue(double t) {
double y = 50.0 * Math.pow(Math.sin(Math.PI * (t / 10.0)), 3);
return y;
}
}