This is V2_Person.java public class V2_Person { private String gNumber; private String firstName; private String lastName; public V2_Person() {
This is V2_Person.java
public class V2_Person {
private String gNumber;
private String firstName;
private String lastName;
public V2_Person() {
}
public V2_Person(String gNumber, String firstName, String lastName) {
if (firstName == null || firstName.equals("")) {
throw new IllegalArgumentException("First name must be provided");
}
if (lastName == null || lastName.equals("")) {
throw new IllegalArgumentException("Last name must be provided");
}
if (gNumber == null || gNumber.equals("")) {
throw new IllegalArgumentException("GNumber name must be provided");
}
this.gNumber = gNumber;
this.firstName = firstName;
this.lastName = lastName;
}
public String getFirstName() { return this.firstName; }
public String getGNumber() { return this.gNumber; }
public String getLastName() { return this.lastName; }
public String hello() {
return this.getFirstName() + " " + this.getLastName() + " says hello!";
}
public String goodbye() {
return this.getFirstName() + " " + this.getLastName() + " says goodbye!";
}
public void setFirstName(String firstName) {
if (firstName == null || firstName.equals("")) {
throw new IllegalArgumentException("First name must be provided");
}
this.firstName = firstName;
}
public void setGNumber(String gNumber) {
if (gNumber == null || gNumber.equals("")) {
throw new IllegalArgumentException("GNumber name must be provided");
}
this.gNumber = gNumber;
}
public void setLastName(String lastName) {
if (lastName == null || lastName.equals("")) {
throw new IllegalArgumentException("Last name must be provided");
}
this.lastName = lastName;
}
public String toString() {
return this.getFirstName() + " " + this.getLastName()
+ " (" + this.getGNumber() + ")";
}
}
this is V2_Student.java
public class V2_Student extends V2_Person {
private String classLevel;
private String major;
public V2_Student() {
// Note: Because no call to a superclass constructor is included
// the compiler will add super() as the first line
}
public V2_Student(String gNumber, String firstName, String lastName, String classLevel, String major) {
super(gNumber, firstName, lastName);
if (classLevel == null || classLevel.equals("")) {
throw new IllegalArgumentException("Class level must be provided");
}
if (major == null || major.equals("")) {
throw new IllegalArgumentException("Major must be provided");
}
this.classLevel = classLevel;
this.major = major;
}
public String getClassLevel() { return this.classLevel; }
public String getMajor() { return this.major; }
public void study() {
//Code inside method
}
}
use JOptionPane, using the jGrasp IDE and public static methods
You have been hired to build a system to track advisor assignments in an academic program. Use the V2 Person.java and V2_Student.java classes from Module 9 as a starting point. Create an Advisor subclass of V2_Person. The Advisor class should have an instance variable called advisees, that is an array of up to 30 V2_Students. Your implementation class should create an array of up to 10 Advisors. It should run as follows: As long as the user hasn't already added 10 advisors, allow them to enter the information for an advisor or end. When the user adds an advisor, then prompt for the information for each advisee. As long as the user hasn't already added 30 advisees for that advisor, allow them to enter the information for another advisee or end (and go back to entering the next advisor). Once all advisors and advisees have been entered, your program should output a well-formatted report of all of the advisors that were entered, along with a list of advisees for each advisor. All user input should be validated using try/catch. Note that you should make sure the data makes sense on its own, but you don't need to check for things like duplicate G numbers.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
To implement the Advisor and Student classes and interact with the user using JOptionPane in the jGRASP IDE you can follow the steps below Please note ...See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started