Hi, below is my code, I am new to Java, is my driver in the wrong place??
package coursework; public class Employee { private String firstName; private String lastName; private int employeeId; private double hourlyRate; public Employee(String firstName, String lastName, int employeeId, double hourlyRate) { setFirstName(firstName); setLastName(lastName); setEmployeeID(employeeId); setHourlyRate(hourlyRate); } public void printEmpDetails() { System.out.println("Name: " + firstName + " " + lastName); System.out.println("Emp. Id: " + employeeId); System.out.println("Hourly Rate: $" + hourlyRate); System.out.println(); } private void setFirstName (String firstName) { // Here we are setting our class variable firstName to the passed in variable "name" // But only if it has a length greater than 0 and less than or equal to 20 int nameLength = firstName.length(); if (nameLength < 1) { System.out.println("First Name length is too small"); System.out.println(firstName + ": " + firstName.length()); } else if (nameLength > 20) { System.out.println("First Name length is too long"); System.out.println(firstName + ": " + firstName.length()); } else { this.firstName = firstName; } } private void setLastName (String lastName) { // Here we are setting our class variable firstName to the passed in variable "name" // But only if it has a length greater than 0 and less than or equal to 20 int nameLength = lastName.length(); if (nameLength < 1) { System.out.println("Last Name length is too small"); System.out.println(firstName + ": " + lastName.length()); } else if (nameLength > 20) { System.out.println("Last Name length is too long"); System.out.println(firstName + ": " + lastName.length()); } else { this.lastName = lastName; } } private void setEmployeeID (int employeeId) { // Here we are setting our class variable firstName to the passed in variable "name" // But only if it has a length greater than 0 and less than or equal to 20 if (employeeId > 9999) { System.out.println("Number length error: this should be less than 9999: " + employeeId); } else if (employeeId < 1000) { System.out.println("Number length error: this should be more than 1000: " + employeeId); } else { this.employeeId = employeeId; } } private void setHourlyRate (double hourlyRate) { // Here we are setting our class variable firstName to the passed in variable "name" // But only if it has a length greater than 0 and less than or equal to 20 if(hourlyRate < 0) { System.out.println("Incorrect value, number must be greater than zero: " + hourlyRate); } else{ this.hourlyRate = hourlyRate; } } public String getFirstName() { // Here we are getting our class variable firstName return firstName; } public String getLastName() { // Here we are getting our class variable lastName return lastName; } public int getEmployeeId() { // Here we are getting our class variable firstName return employeeId; } public double getHourlyRate() { // Here we are getting our class variable firstName return hourlyRate; } } package coursework; import java.util.Scanner; public class Driver { public static void main(String[] args) { // First we variable of type Employee. // We always set this to null as good practice. Employee e = null; // Declare variables to hold user inputs needed // by the Employee constructor String firstNameInput; String lastNameInput; int idInput; double rateInput; // Get input data values from the user (via the keyboard) Scanner userInput = new Scanner(System.in); System.out.println("Employee First Name: "); firstNameInput = userInput.next(); System.out.println("Employee Last Name: "); lastNameInput = userInput.next(); System.out.println("Employee Id: " ); idInput = userInput.nextInt(); System.out.println("Employee Hourly Rate: "); rateInput = userInput.nextDouble(); // Now allocate a new instance of an Employee, // passing test data to the constructor. e = new Employee(firstNameInput, lastNameInput, idInput, rateInput); // Print out the data with nice titles System.out.println(); System.out.println("Name: " + e.getFirstName() + " " + e.getLastName()); System.out.println( "Emp. Id: " + e.getEmployeeId()); System.out.println("Hourly Rate: $" + e.getHourlyRate()); // We're done with this employee, so now free up // the space we allocated for that employee by setting // the "e" variable back to null e = null; System.out.println(); } }