Question: JAVA!!! (extends base class RutgersPerson) Create a class called RutgersStaff that does the following: 1) Inherits from the base class we used in the last
JAVA!!!
(extends base class RutgersPerson)
Create a class called RutgersStaff that does the following:
1) Inherits from the base class we used in the last lecture
2) Each instance of RutgersStaff should have a String departmentName
3) Create the appropriate setter and getter methods for departmentName
a) There are no special requirements for verifying the data, so just assume the user will enter valid data
4) Override the setNetId method to store the NetID in all capital letters a) There are no special requirements for verifying the data, so just assume the user will enter only letters and numbers
5) Override the toString method to print the last name, first name, NetID, and department onto one like this: FIRSTNAME LASTNAME works for the DEPARTMENTNAME and the NetID is NETID Where the bold/italicized text is replaced with the values of the instance variables
public class RutgersPerson {
private String lastName;
private String firstName;
private String netId;
public RutgersPerson(){
this.lastName = "Matos";
this.firstName = "Arcadio";
this.netId = "arodjr";
}//end of no argument contstructor
public RutgersPerson(String lastName, String firstName, String netId){
this.lastName = lastName;
this.firstName = firstName;
this.netId = netId;
}//end of constructor with 3 arguments
public String getLastName() {
return lastName;
}//end of getLastName()
public String getFirstName() {
return firstName;
}//end of getFirstName()
public String getNetId() {
return netId;
}//end of getNetId()
public void setLastName(String lastName) {
this.lastName = lastName;
}//end of setLastName(String lastName)
public void setFirstName(String firstName) {
this.firstName = firstName;
}//end of setFirstName(String firstName)
public void setNetId(String netId) {
this.netId = netId;
}//end of setNetId(String netId)
}//end of RutgerPerson
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
