Question: HELP IN JAVA Create a class called Person. A Person has a name - this is the only attribute. Name is a String, and may

HELP IN JAVA

Create a class called Person. A Person has a name - this is the only attribute. Name is a String, and may have spaces.

Create a default constructor that sets name to null. Create another constructor that has one parameter, the name. Create all accessors and modifiers. Then create a method to determine if two Person objects have the same name. This method is called "hasSameName" and returns a boolean. Finally, include a writeOutput method

public void WriteOutput() { System.out.println( "Name: " + name); }

2. Create a class named Employee, derived from Person .

An Employee inherits an employee's name from the class Person. In addition, an Employee has an annual salary (represented by a single value of type double), a hire date that gives the year hired (as a single value of type int), an identification number of type int, and a department of type String. Write all constructors, accessors, mutators, a WriteOutput method, and an equals method that returns true if two employees are equal, false otherwise . Two employees are equal if their IDs are equal. Write a main method to FULLY test your class definitions.

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