Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a program for managing an employee database. The required functionality i

ID: 3596834 • Letter: C

Question

Create a program for managing an employee database. The required functionality is: 1) An Employee class, with the following methods and attributes: Data members: firstName (String), lastName (String), ssn (long), employeeld (int) department (String), and jobTitie (String). a. b. Constructor methods: One method requiring parameters for firstName, lastName, ssn, and employeeld Department and job Title will be assigned default values of "unknown" One method requiring parameters for firstName, lastName, ssn, employeeld, department, and job Title c. "Set" methods for changing firstName, lastName, department, and job Title which accept a single String as a parameter for updating the preexisting String. "Get" methods for returning each of the attributes in 1a d·

Explanation / Answer

class Employee {
//Defining variables as private so that restrict the access outside the class
private String firstName;
private String lastName;
private long ssn;
private int employeeid;
private String department;
private String jobTitle;
  
//First Constructor of assigning default value as "unknown"
Employee(){
this.firstName = "unknown";
this.lastName = "unknown";
this.ssn = 0;
this.employeeid = 0;
this.department = "unknown";
this.jobTitle = "unknown";
}
//Second Constructor of assigning defined values while creating the class
Employee(String firstName, String lastName, long ssn, int employeeid, String department, String jobTitle){
this.firstName = firstName;
this.lastName = lastName;
this.ssn = ssn;
this.employeeid = employeeid;
this.department = department;
this.jobTitle = jobTitle;
}
//setter methods
public void setFirstName(String firstName){
this.firstName = firstName;
}
public void setLastName(String lastName){
this.lastName = lastName;
}
public void setSsn(long ssn){
this.ssn = ssn;
}
public void setEmployeeId(int employeeid){
this.employeeid = employeeid;
}
public void setDeparment(String department){
this.department = department;
}
public void setJobTitle(String jobTitle){
this.jobTitle = jobTitle;
}
//getter methods
public String getFirstName(){
return this.firstName;
}
public String getLastName(){
return this.lastName;
}
public long getSsn(){
return this.ssn;
}
public int getEmployeeId(){
return this.employeeid;
}
public String getDepartment(){
return this.department;
}
public String getJobTitle(){
return this.jobTitle;
}

public static void main(String args[]){
Employee emp = new Employee();
System.out.println("Employee FirstName:"+emp.getFirstName());
emp.setFirstName("Prakash");
System.out.println(emp.getFirstName());
Employee e = new Employee("Sindhu","Vegi",1234,123456,"Production","Analyst");
System.out.println(e.getDepartment());
}
}

/* Sample Output:

*/

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote