Question
This is in Java: Create a user defined class called Employee. An employee object stores information about an employee. Each employee has a first name,
This is in Java:
Create a user defined class called Employee.
An employee object stores information about an employee. Each employee has a first name, last name, birth date and hire date. You will implement the following with the Employee class:
Instance variables firstName, lastName, birthDate (Date type), hireDate (Date type).
Variable to keep track of the count of Employee objects created. Hint: there will be only one copy of this variable that is shared by all the objects of this class.
Create default and parametric constructors. Note that to initialize birthDate and hireDate the constructors will need parameters of Date type.
Create a method getEmployeeCount( ) that returns the current count of the Employee objects.
Create a toString( ) and equals method ( ).
Include JavaDoc style comments along with pre-conditions, post-conditions for each of the mutator methods. The comments should also include a description of the method along with information about any exceptions the method could possibly generate.
Next, you would implement a client program EmployeeTest to test the Employee class. Do the following the EmployeeTest class.
Implement the main method.
Create an array of Employee type of length 5.
Call the getEmployeeCount( ) method and print its return value to the output window.
Use a for loop to prompt the user for necessary information (names, birth dates and hire dates to create 5 Employee objects and assign these Employee objects to the array that you create.
Use a for loop to retrieve one employee object at a time and call its toString( ) method and print the return value on the output window.
Demonstrate the usage of the equals( ) method by calling the equals( ) method to compare the Employee object in the 2nd index position and the 4th index position.
Display the current count of Employee objects by calling getEmployeeCount( ) method.
Make sure to keep make your output verbose and comment your code.
Thank you for the help.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started