The person class should have instance variables and clerk


Create a class Person and Clerk derived from (a sub class of) Person. The Person class should have instance variables and Clerk class should have the additional information of a salary and an employmentgrade.

Eg, a clerk's employment grade might be (CR-1, CR-2, etc.) Both class should have the accessors, mutators and a toString() method. The toString() method in Clerk class will include a call the toString() method of the super class(Person).

A Person Has A Telephone, Address, Name, Email

The Clerk class will have an equals() method. It must override the equals method of the parentclass(Person). The equals method in the Person class to override the equals method in the Object class. We considered the difference between using == and equals() method with String objects.

Any class can, and should, define its own equals method. So, what does it mean that one clerk equals another clerk? We can define this such as two Clerk objects are equal, if they have the same salary and grade.

So, clerk1.equals(clerk2) will return true if their salary and grade are "equal" by the definition. You might notice that when comparing String objects, you must use the equals method defined in the String class, as opposed to the relational == operator.

The equals method MUST accept an Object as its parameter.

2) Create a .java file and use it to demonstrate following minimum:

- Your clerk Class is functioning, and the methods are correct. Create several clerks, compare them to each other using the equals method, and output clearly when one object is equal to another. Print out the objects as well

- You can output the address of a clerk object

- You can change the zip code of a clerk object and print zip code before and after change.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: The person class should have instance variables and clerk
Reference No:- TGS02871186

Expected delivery within 24 Hours