Ok I have a class in OOP and instructor marked me off for havethis.employeeId this.HourlyRate this.firstName this.lastName
Anyways here is my code, I tried to fix it, but every time the whole thing collapses and get errors, any help would be greatly appreciated
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package coursework; public class Employee { private String firstName; private String lastName; private int employeeId; private double hourlyRate; private Timecard timeCard; public Employee(String firstNameInput, String lastNameInput, int idInput, double rateInput, int[] daysIn) { setFirstName(firstNameInput); setLastName(lastNameInput); setEmployeeID(idInput); setHourlyRate(rateInput); setTimeCard(new Timecard(daysIn)); } 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; } } private void setTimeCard(Timecard newtimeCard) { if (newtimeCard == null) { System.out.print("time card cannot be null"); System.exit(-1); } timeCard = newtimeCard; } public Timecard getTimeCard() { return timeCard; } 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; } }