Question: Employee.Java The UML below defines the needed field variables (three of them) and their types, the constructor, and the needed methods. Define a constructor for

Employee.Java

The UML below defines the needed field variables (three of them) and their types, the constructor, and the needed methods.

Define a constructor for the class. The details of the constructor interface are shown in the UML specification below. The values supplied as arguments for the constructor are used to initialize the corresponding fields (see next item).

Create the three instance variables as requested. The names for these instance variables are specified in the UML below.

Create the getters and setters for each of the properties first, last and monthlySalary, that use these instance variables. The property yearlySalary has only a getter, but no setter. Note the names of the properties are not the same as the identifiers of the instance variables.

Create a method in the Employee class, named displayValues, that writes to the standard output file the employee's complete name, monthly salary, and annual salary. The test program will use calls to that method to display Employee object values. See examples of this output in the output sample below.

Override the inherited toString method.

public class Employee

{

private String firstNameFieldValue;

private String lastNameFieldValue;

private double salaryFieldValue;

public Employee(String firstName, String lastName, double initialSalary)

{

}

public void displayValues() {}

public String getFirst()

{

/* Dummy return as return is required by the compiler. Replace! */

return null;

}

public void setFirst(String firstName) {}

public String getLast()

{

/* Dummy return as return is required by the compiler. Replace! */

return null;

}

void setLast(String lastName) {}

public double getMonthlySalary()

{

/* Dummy return as return is required by the compiler. Replace! */

return Double.POSITIVE_INFINITY;

}

public void setMonthlySalary(double salary) {}

public double getYearlySalary()

{

/* Dummy return as return is required by the compiler. Replace! */

return Double.POSITIVE_INFINITY;

}

@Override

public String toString()

{

/* Dummy return as return is required by the compiler. Repalce! */

return null;

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!