So i am trying to add items to an arraylist, However when I try to write the add method the IDE gives me an error that I'm passing "name, cusip and ticker wrong. Can someone explain to me what I am doing wrong here? Thank you in advance.
Here is my ETF class
package fundProject;
import java.util.Scanner;
public class ETF extends AbstractETF {
private String name;
private int cusip;
private int ticker;
public ETF(String name, int cusip, int ticker) {
this.name = getName();
this.cusip = getCusip();
this.ticker = getTicker();
}
public int getCusip() {
System.out.println("Please enter the Cusip of the ETF");
Scanner sc = new Scanner(System.in);
cusip = sc.nextInt();
return cusip;
}
public int getTicker() {
System.out.println("Please enter the Ticker of the ETF");
Scanner sc = new Scanner(System.in);
ticker = sc.nextInt();
return ticker;
}
public String getName() {
System.out.println("Please enter the Name of the ETF");
Scanner sc = new Scanner(System.in);
name = sc.next();
return name;
}
}
And here is my main class
package fundProject;
import java.util.ArrayList;
public class mainClass {
public static void main(String[] args) {
ArrayList<ETF> etfArrayList = new ArrayList<ETF>();
etfArrayList.add(new ETF(name, cusip, ticker));
}
}