public Student(String name, String sch, int stay, String year)
{
String name1 = getInput("Enter your name:");
this.name = name1;
String sch1 = getInput("Enter your scholarship:");
this.sch = sch1;
String number = getInput("Enter years of stay: ");
this.stay = Integer.parseInt(number);
for (int i=0; i < programList.size(); i++)
{
if (stay==1)
{
//If the student's year of stay is only 1 year I will put he/she to the "freshmenList". How will I do that?
}
}
Here's my code. I want to sort the inputed elements to a new ArrayList according to the years of stay input. (If year of stay = 1 then freshmen arraylist, if=2 then sophomore arraylist, so on). How will I do that? Thank you!