java - Populating an array Using Polymorphism -


here code. did work bit off. supposed not 1 applicant, supposed many , supposed populate applicants 2 different arrays, 1 graduates, , 1 undergraduates. need figuring out how make empty array , fill applicants in those. start help

import java.util.scanner;  public class collegeapplicant { string applicantname; string collegename; public string getapplicantname() {     return applicantname;  } public void setapplicantname(string applicantname) {     this.applicantname = applicantname;  } public string getcollegename() {     return collegename;  } public void setcollegename(string collegename) {     this.collegename = collegename;  } public void checkcollege() {     int choice;     graduate g = new graduate();     undergraduate ug = new undergraduate();     scanner input = new scanner(system.in);     system.out.println("1. undergraduate");     system.out.println("2. graduate");     system.out.println("enter choice ");     choice = input.nextint();     if (choice == 1)     {         system.out.println("enter sat marks :");         ug.sat = input.nextdouble();         system.out.println("enter gpa marks :");         ug.gpa = input.nextdouble();      }     else     {         system.out.println("enter origin of college:");         g.collegeorigin = input.next();         system.out.println("status :" + g.checkcollege());      }  } public class undergraduate {     double sat;     double gpa;  } public class graduate {     string collegeorigin;     string checkcollege()     {         string information = null;         if (collegename.equals(collegename)) information = "applicant applying inside";         else information = "applicant applying outside";         return information;      }  }  } 

the client

import java.util.scanner;  public class collegeapplicantclient extends collegeapplicant { public static void main(string[] args) {     testcollege tc = new testcollege();     scanner input = new scanner(system.in);     system.out.println("enter name of applicant ");     tc.setapplicantname(input.next());     system.out.println("enter college name of applicant ");     tc.setcollegename(input.next());     tc.checkcollege();    }   } 

here example of possible output

name: joe  college applied to: harvard  sat:    5  gpa:    2  name: tom  college applied to: yale  college of origin: nyu – outside 

i need able put graduates in array , undergrads in array. display when it's done