Problem

Define a class named Employee whose objects are records for employees. Derive this class f...

Define a class named Employee whose objects are records for employees. Derive this class from the class Person given in Listing. An employee record inherits an employee’s name from the class Person. In addition, an employee record contains an annual salary represented as a single value of type double,  a hire date that gives the year hired as a single value of type int, and an identification number that is a value of type String. Give your class a reasonable complement of constructors, accessor methods, and mutator methods, as well as an equals method. Write a program to fully test your class definition

public class Person{   private String name;   public Person()   {      name = "No name yet";   }   public Person(String initialName)   {      name = initialName;   }   public void setName(String newName)   {      name = newName;   }   public String getName()   {      return name;   }   public void writeOutput()   {      System.out.println("Name: " + name);   }   public boolean hasSameName(Person otherPerson)   {      return this.name.equalsIgnoreCase(otherPerson.name);   }}

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 8
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT