Employee Class Employee Class Write a class named Employee that has the followin
ID: 3678483 • Letter: E
Question
Employee Class
Employee Class Write a class named Employee that has the following member variables name. A string that holds the employee's name idNumber. An int variable that holds the employee's ID number. department. A string that holds the name of the department where the employee works. position. A string that holds the employee's job title. The class should have the following constructors: A constructor that accepts the following values as arguments and assigns them to the appropriate member variables: employee's name, ID number, department, and position. A constructor that accepts the following values as arguments and assigns them to the appropriate member variables: employee's name, ID number. The department and position members should be assigned the empty string (""). A default constructor that assigns the empty string to the string members and 0 to the ID number.Explanation / Answer
public class Employee {
String name;
int idNumber;
String department;
String position;
Employee(String name,int idNumber,String department,String position)
{
this.name=name;
this.idNumber=idNumber;
this.department=department;
this.position=position;
}
Employee(String name,int idNumber)
{
this.name=name;
this.idNumber=idNumber;
this.department="";
this.position="";
}
Employee()
{
this.name="";
this.idNumber=0;
this.department="";
this.position="";
}
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.