Implement a class named Employee. An employee has a name (a string) and a salary (a double). Write a constructor with two parameters (name and salary), and methods to return the name and salary. Add a method raiseSalary (double percent) that raises the employee's salary by a certain percentage and a method setSalary(double salary) that replaces the current salary with salary. Write a small program that tests all of the methods in your class.
Step 1: Consider the kind of operations you want to carry out. These are actions that will be furnished by your class and should be verbs. This will give you the methods in the class.
Step 2: Determine the instance fields (data) for your class. Determine what information an object needs to store to do its job. List beside each method from step 1 the information that is necessary to complete the task.
Step 3: Consider how you will need to initialize a new employee. This will give you the constructor(s).
Step 4: Write the public interface by listing your constructors and methods below. Be sure and document what each method should do.
Step 5: Create your project and begin implementing the class using method stubs (methods without the code) and comments describing what the methods will do.
Setup:Step 6: Implement the constructors and methods using the comments you wrote in the stubs. Compile your project to check for any errors.
Step 7: Test your class. Write the main method of EmployeeTest.java.
Solution: employee.zip