Question: (JAVA) Define a new class Employee where one object of class Employee represents the information about one Employee. Each Employee object will have: private field

(JAVA)

Define a new class Employee where one object of class Employee represents the information about one Employee. Each Employee object will have:

private field for first name

private field for last name

private field for social security number

private field for salary

constructor method with a parameter for the initial value of each private field

constructor method with no parameters

getter and setter methods for each of the private fields

toString() method to return the object's data in a String

giveRaise() method that takes a float "percentRaise" as parameter and doesn't return anything. When you call this method and send it a "percentRaise", this method adds "percentRaise" percent of the current salary to the salary field of the object that calls it, thus giving that Employee a raise in salary.

You must also define a second class (in a second source code file) for testing class Employee that contains the main(). This second class (you can call it class TestEmployee) will allocate objects of class Employee and call methods on the objects of class Employee like your main() from the previous assignment did for class Rectangle.

Write and test each Employee method one at a time. Make sure that all fields and methods work as expected before proceeding to write and test the next Employee method. The program that you submit to me must:

- consist of two source code files, one contains the definition of class Employee, and one contains the test program.

- Your second source code file must include a main() that (in one run) proves that all methods in class Employee work correctly. Because this main() might be long, you do not have to adhere to Program Guideline #12 .

- Include all documentation that is required in Program Guideline #3 from the Week 6 Module.

- Paste a copy of the console (after your program runs) to the bottom of one of the source code files.

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!