Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

1. 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.

THEN upload ONLY your Person.java and Employee.java file to Canvas.

image text in transcribed

Rubric:

Constructors (one default, one with all info)

Accessors for Employee (salary, hireDate, ID, department

Mutators for Employee (salary, hireDate, ID, department)

equals for Employee

WriteOutput for Employee

Constructors for Person

Accessors and Mutators for Person

hasSameName in Person

comments

Thank You in advance. Thumbs up for answers Person Student Employee Undergraduate Graduate Faculty Staff Masters Doctoral Nondegree

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions