I was wondering how do I go about adding this to my code?
Now, create public accessor & private modifier methods (gets & sets) in the “Employee.java” file for each of the 4 data
members. Use the following as the error-checking criteria in your modifier (“set”) methods:
- First Name & Last Name: Must have size greater than zero, and size less than or equal to 20.
- Employee Id: Value must be greater than or equal to 1000, but less than or equal to 9999.
- Employee Rate: Must be greater than zero.
public class Employee { public String firstName; public String lastName; private double hourlyRate; private int employeeId; private Employee(String first, String last, double hourly, int employeeID) { firstName = first; lastName = last; hourlyRate = hourly; employeeId = employeeID; } public static void main(String[] args) { Employee e = new Employee("John", "Doe", 14.79, 1597); System.out.println("Name: " + e.firstName + " " + e.lastName); System.out.println("Hourly: $" + e.hourlyRate); System.out.println("EmployeeID: " + e.employeeId); System.out.println(); // This will simply create a blank line e = new Employee("Sarah", " Dao", 17.55, 2574); System.out.println("Name: " + e.firstName + " " + e.lastName); System.out.println("Hourly: $" + e.hourlyRate); System.out.println("EmployeeID: " + e.employeeId); System.out.println(); }}