SO i feel totally annoying but I got to ask for advice.
As you see in the title im trying to call a constructor from an other class. Im trying to add and create a new gymMember for every weight that is found in the file into a new array reading the weights of the members from that file.
We had to create a gymMember class with the properties memberid and membersweights first. Memberid since the file is filled with amount of numbers only and no strings (names). And then an other class where we create the arraylist. Im guessing we have to do it this way in order to call for a constructor in the gymMember class
I cant get it to work, i know my method for adding the members into the array is correct but the constructor is wrong somehow, its not called
i hope im being clearer this time :)
public class GymMember {
public GymMember(double membersweight, int membersid) {
}
public class MemberWeight {
ArrayList members = new ArrayList();
public MemberWeight(){
this.members = new ArrayList();
}
public void getMembers() throws FileNotFoundException{
int membersid = 0;
double membersweight = 0;
try {
Scanner input = new Scanner(new FileInputStream("C:\\prov\\vikt-fore_data2Update.csv"));
while(input.hasNextDouble()){
membersweight = input.nextDouble();
members.add(new GymMember( membersweight , membersid ));
membersid++;
}
} catch (FileNotFoundException ex) {
System.out.println("");
}