Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an abstract super-class encapsulating a college applicant: A college appli

ID: 647893 • Letter: W

Question

Write an abstract super-class encapsulating a college applicant: A college applicant has two attributes : the applicant's name and the college the applicant is applying to. This class has two non-abstract sub-classes: one encapsulating an applicant for undergraduate school and the other encapsulating an applicant for graduate school. An applicant for undergraduate school has two additional attributes: an SAT score, and a GPA. An applicant for graduate school has one additional attribute: the college of origin. It also has a method which returns "from inside" if the college of origin is the same as the college applied to; otherwise, it returns "from outside." You also need to include a class to test these two classes.

with the following modifications/requirements:

Name your NetBeans project lab07

Name your main/client class Lab07

Name your abstract superclass Applicant

Name your undergraduate subclass Undergrad

Name your graduate subclass Grad

In your client class:

Create a single ArrayList named list to hold all of the applicants ( both undergraduate and graduate ).

Populate the ArrayList with at least two undergraduate applicants and two graduate applicants.

You can

Explanation / Answer

import java.util.*;

public class stud
{
private String m_name;
private int m_yea;
private String m_course;
private String m_year;
private String m_section;

public stud( String name, int yea, String course, String year, String section )
{
m_name = name;
m_yea = yea;
m_course = course;
m_year = year;
m_section = section;
}

public String getName()
{
return m_name;
}

public int getyea()
{
return m_yea;
}

public String getCourse()
{
return m_course;
}

public String getYear()
{
return m_year;
}

public String getSection()
{
return m_section;
}

public String toString()
{
return "name: " + m_name + ", yea: " + m_yea +
", course: " + m_course + ", year: " + m_year +
", section: " + m_section;
}

public static void main(String[] args)
{
ArrayList<stud> studs = new ArrayList<stud>();
Scanner input = new Scanner(System.in);

int menuChoice = 4;
do {
  
  
try {
System.out.println("Enter a choice: ");
menuChoice = Integer.parseInt(input.nextLine());
} catch (NumberFormatException e) {
continue;
}

if (menuChoice==1)
{
System.out.println("Full name:");
String name = input.nextLine();

int yea = -1;
do {
try {
System.out.println("yea:");
yea = Integer.parseInt(input.nextLine());
} catch (NumberFormatException e) {
System.out.println("Enter a number!");
continue;
}
} while (yea <= 0);

System.out.println("Course:");
String course = input.nextLine();

System.out.println("Year:");
String year = input.nextLine();

System.out.println("Section:");
String section = input.nextLine();

stud stud = new stud(name, yea, course, year, section);
studs.add(stud);

} else if (menuChoice==2) {
System.out.println("studs:");
for (stud stud : studs)
{
System.out.println(stud);
}
}
} while (menuChoice<4);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote