Question
Using Java
Question 2: (practice to write the code for mutator methods) A class named Employee yourlastName that holds following private duta members(attributes Name: is a String that holds the employee's name * employeeld: is an iet that holdh the employee's ID number e department: is a String that holds the name of the department where the employee works * titke: is a String at holds the employee's jub tittle The Employee yourlastName class shoukd alo have the following public mutator methods o setFulName: the method that set a new value for the ield fulName a setEmployeesd: the method that set a new value for the field employeeld o setoepsrtment: the mathod that set a new value for the field department o setTitle: the method that set a new value for the tiald title write the Java code of class Employee yourLast Name that contains a. 4 above private dats members b. No-angument conatructor and parameter constructor c. 4 mutator methods for each field
Explanation / Answer
import java.util.*;
class Employee_yourLastName{
private String fullName;
private String employeeId;
private String department;
private String title;
//public mutator methods
public void setFullName(String fulName){
this.fullName = fullName;
}
public void setEmployeeId(String employeeId){
this.employeeId = employeeId;
}
public void setDepartment(String department)[
this.department = department;
}
public void setTitle(String title){
this.title = title;
}
// No-argument constructor
public Employee_yourLastName(){
}
// Parameter constructor
public Employee_yourLastName(String fullName,String employeeId,String department,String title){
}
}