Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implement a user defined class called Employee . An employee object stores the f

ID: 3770321 • Letter: I

Question

Implement a user defined class called Employee. An employee object stores the following information about an employee - name, gender, and isMarried, salary. You will implement the following in the Employee class.

Instance variables name (String type), gender (char type), isMarried (boolean type), and salary (double type).

A static variable called countOfEmployees to track of the count of Employee objects created.

Create appropriate constructors to initialize the instance variables

Provide get and set methods for each of the instance variables with appropriate code for validation.

Create a method getEmployeeCount( ) that returns the current count of the Employee objects

Provide a toString( ) and equals method ( )

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Next you would implement a client program EmployeeTest to test the Employee class. Do the following the EmployeeTest class.

Implement the main method

Call the getEmployeeCount( ) method and print it’s return value to the output window.

Create two Employee objects using the constructors defined in Employee class. Set the first Employee’s name to “John Doe” and second employee name to “Mary Jane”. Use appropriate values to initialize the other instance variables.

Display the current count of Employee objects by calling getEmployeeCount( ) method

Call the toString( ) method on each of the employee objects and print it to the output window.

Call the setSalary( ) method on John Doe and set his salary as the same value as Mary Jane’s salary.

Demonstrate the usage of the equals( ) method by calling the equals( ) method to compare the contents of the two employee objects.

Explanation / Answer

Implement a user defined class called Employee . An employee object stores the f

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote