Implement a class Employee
. An employee has a name
(a String
) and a salary
(a double value). Provide a constructor with two arguments
public Employee(String employeeName, double currentSalary)
and methods
public String getName()
public double getSalary()
public void raiseSalary(double byPercent)
These methods return the name and salary, and raise the employee's salary by a certain percentage.
Then write the main()
program EmployeeTester
that demonstrates the use of the Employee
class.
Sample usage:
Employee harry = new Employee("Hacker, Harry", 50000);
harry.raiseSalary(10); // Harry gets a 10 percent raise