View the step-by-step solution to:

I don't get how to create the parameters for question 3. Create a new class called Employee that is derived form the Person class.

Can someone help me!! I don't get how to create the parameters for question 3.

Create a new class called Employee that is derived form the Person class. The new class has the additional attributes of ssn (Social Security Number) (type String) and annual salary (type double). Be sure your class has a reasonable complement of constructors and accessor methods, and an equals method:
1. Add two instance variable: String ssn and double salary; (5 points)
2. Your derived class name is Employee, therefore your file name is Employee. Java.
3. You will define four constructors: (15 points) Make sure salary is not negative.
* Without any parameters, codes given below
* public Employee(){
ssn = “000000000”;
salary = 0; }
* With one parameter name. Set salary = 0 and ssn = ‘00000000’.
* With two parameters name, and salary; let ssn = ‘000000000’. (default).
* With three parameters name, salary, and ssn.
4. Give a new definition of writeOutput(). This is an overridden method. (10 points)
* The original output from the base class (remember the super keyword).
* Output salary.
* Output the ssn..
5. Write three mutator methods: (10 points)
* To reset name, salary, and ssn. The instance variables in the base class can be accessed through base class’s set method. Remember again the super keyword here.
* To reset ssn only.
* To reset salary.
6. Write two accessor methods: (10 points)
* To get ssn.
* To get salary.
7. Add an equals method that test two Employee objects are equal or not. Two objects are equal if they have the sane name, sane ssn and same salary. The header for this method will be: (10 points)
Public Boolean equals(Employee other Employee) { }
8. You need to document both programs follow my previous suggestions. Your code should be written in a way that is easy to read.
* Add comments for each method: purpose of each method. Add precondition/post-condition for each method.
* Add compilation instruction. E.g.,java and java
* Add executing instructions. E.g., java Employee (5 points).
B. Write a test program (file name: that reads in five employees info of type Employee from the keyboard and at the end of the input prints out the name, ssn and salary of all employees that made more than $100,000 in salary. (Similar logic setup as your assignment 7).
1. You will use array to hold all employee info.
2. Declare the array size to be 5.
3. Use a looping method to enter info for 5 employees.
4. Be sure to check your inde during your input loop so you don’t get an array index out of bound exception during run time.
5. After each loop, echo all info to the screen as shown here:
Enter first employee’s name:
James Doe
Enter his employee’s salary in dollars:
Enter this employee’s ssn:
You have entered the following DOG:
Name: James Doe
Salary: 50000
SSN: 123-45-6789
Enter second employee’s name:
…………. And so forth………..
6. At the end of the input, prints out the name and salary of all employees that made over $100,000. Check the Employees array one by one.
The following employees made more than $100,000:
Name Salary
Frank Mae 101,000
Alice Visbee 105,000
7. Pick two Employee objects and test whether they are equal or not with the equal method in the Employee class and out a informed message to the screen.

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 sameName(Person otherPerson)
return (;


Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.


Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question