Question: Create a class called Employee whose objects are records for an employee. This class will be a derived class of the class Person which you

Create a class called Employee whose objects are records for an employee. This class will be a derived class of the class Person which you will have to create. An employee record has an employee's name (inherited from the class Person), an annual salary represented as a single value of type double, a year the employee started work as a single value of type int and a social security number, which is a value of type String.
Write a class containing a main() method to fully test your class definition.
Person class requirements:
One private attribute of type String that stores the name of the person object, with getter and setter.
Default constructor that creates a person object with an empty string ("") as the name attribute.
A constructor that accepts a string to be assigned as the name of the object.
Override the toString method so it returns a string representation of the Person object, which should be the name attribute.
Implement the public boolean equals(Object otherPerson) method so it returns if the name of this object is the same as the name of the otherPerson object or not.
public class Person {}
Employee class requirements:
One private double attribute to hold the value for the annual salary of the employee, with a getter method getSalary().
A private int attribute to store the year which the employee started working with a getter method getYear().
A private String attribute to stode the social security number of the employee.
A constructor that accepts four parameters in this order: a String for the name, a double for the annual salary, an int for the starting year, and another String for the social security number.
Override the equals() method so that it compares the social security number of the objects, instead of the name attribute.
public class Employee {}
Create a class called Employee whose objects are

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 Programming Questions!