Get an ArrayList from another class
I have a problem (obviously!)
I have a class ReadFile where I read a file and store my data in an ArrayList of Doubles. I have another class where is my library and there I do all the work (I have ther 2 Constractors, one wich will get 2 doubles from the user and one wich will get the ArrayList from the file).
I want to take the ArrayList and put it in the second constractor.
What I have achieved so far?
Well I have read the data and put it in the ArrayList (i know it is correct cause I Debugged it).
But I don't know what wrong i have done in my library... Ok I'm gonna what I do in the Library and please correct me if I am wrong.
The above functions are not the true ones cause it's for an assignment and I don't know if I am allowed to put my work here.
public class myLibrary
ReadFile rf = new ReadFile();
private Double x, y;
//The set and get methods are supposed to work for the 1st constractor too.
public void setX(Double x)
public double getX()
public void setY(double y)
public double getY()
public myLibrary(ArrayList<Double> myArray)
myArray = double_numbers;
x = A_function(myArray);
y = Another_function(myArray);
public double A_function(ArrayList<Double> myArray)
double local_x, k=0;
for (int i=0; i< myArray.size(); i++)
k += i;
local_x = k;
public double Sd(ArrayList<Double> myArray)
double local_y=0, k=0;
double local_x = A_function( myArray);
for(int i=0; i< myArray.size(); i++)
k += 2*local_x;
local_y = k;
Is this code wrong? or my problem is elsewhere?
Thank in advance for your time!