This is V2_Person.java public class V2_Person { private String gNumber; private String firstName; private
Question:
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
Modern Database Management
ISBN: 9780134773650
13th Edition
Authors: Heikki Topi, Jeffrey A Hoffer, Ramesh Venkataraman