Define a class named Employee whose objects are records for employees. Derive this class from the class Person given in Listing 8.1. 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.

This project should be pretty straightforward. The solution shown here has nine constructors, including a default that specifies nothing. Since it did not seem reasonable to have salary, hire date or social security numbers without a name, the remaining constructors all require at least the name to be specified. Note the use of methods from the base class, Person. For example, super.writeOutput()is used to write just the name (and avoid using the local version in Employee that writes out all the parameters).


See the code in Employee.java and EmployeeTest.java.

Computer Science & Information Technology

You might also like to view...

What are the disadvantages of using network-level broadcasting to locate resources:

i) in a single Ethernet? ii) in an intranet? To what extent is Ethernet multicast an improvement on broadcasting?

Computer Science & Information Technology

Which of the following is a correct definition for a Rectangle class in Java?

A. public Rectangle class { double length; double width; public double getArea() { return length * width; } public double getPerimeter() { return 2 * (length+width); } } B. public Rectangle class { double length; double width; public getArea():double { return length * width; } public getPerimeter():double { return 2 * (length+width); } } C. public class Rectangle { double length; double width; public double getArea() { return length * width; } public double getPerimeter() { return 2 * (length+width); } } D. public class Rectangle { double length; double width; public getArea():double { return length * width; } public getPerimeter(): double { return 2 * (length+width); } }

Computer Science & Information Technology

An object can be removed from an STL list by adjusting the link information in ____ link variables.

A. none of the B. one C. two D. all

Computer Science & Information Technology

A hardware device or software connecting two or more networks or network segments that use different packet formatting, different communication protocols, and different access methods is called a ____.

A. gateway B. router C. hub D. data switch

Computer Science & Information Technology