Using Java,please the right answer I want. Question 2: (practice to write the co
ID: 3852243 • Letter: U
Question
Using Java,please the right answer I want. Question 2: (practice to write the code for mutator methods) A class named Employee_yourLastName that holds following private data members (attributes): • fullName: is a String that holds the employee’s name • employeeId: is an int that holds the employee’s ID number • department: is a String that holds the name of the department where the employee works • title: is a String at holds the employee’s job tittle The Employee_yourLastName class should also have the following public mutator methods: o setFullName: the method that set a new value for the field fullName o setEmployeeId: the method that set a new value for the field employeeId o setDepartment: the method that set a new value for the field department o setTitle: the method that set a new value for the field title Write the Java code of class Employee_yourLastName that contains: a. 4 above private data members b. No-argument constructor and parameter constructor c. 4 mutator methods for each field
Explanation / Answer
Java Class :
class Employee_yourLastName {
private String fullName, department, title;
private int employeeId;
public Employee_yourLastName() {
}
public Employee_yourLastName(String fullName, String department, String title, int employeeId) {
this.fullName = fullName;
this.department = department;
this.title = title;
this.employeeId = employeeId;
}
public String getFullName() {
return fullName;
}
public void setFullName(String fullName) {
this.fullName = fullName;
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getEmployeeId() {
return employeeId;
}
public void setEmployeeId(int employeeId) {
this.employeeId = employeeId;
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.