Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions