330,507 views
30 votes
30 votes
Design a class named Employee. The class should keep the following information in fields: Employee first name Employee last name Employee number in the format XXX-L, where each X is a digit within the range 0-9 and the L is a letter within the range A-M. Hire Date Write one or more constructors and the appropriate accessor and mutator methods for the class.

User Kaspermoerch
by
2.6k points

1 Answer

23 votes
23 votes

Answer:

Step-by-step explanation:

The following is written in Java and creates the Employee class with the variables requested and a getter setter method for each variable

package sample;

public class Employee {

private String lastName, firstName, idNumber;

public void Employee() {

}

public String getLastName() {

return lastName;

}

public void setLastName(String lastName) {

this.lastName = lastName;

}

public String getFirstName() {

return firstName;

}

public void setFirstName(String firstName) {

this.firstName = firstName;

}

public String getIdNumber() {

return idNumber;

}

public void setIdNumber(String idNumber) {

this.idNumber = idNumber;

}

}

User Ophir Yoktan
by
3.2k points