Question: 3.1 Implement a class Employee. An employee has a name (a string) and a salary (a double). Provide a constructor with two parameters public Employee(String

3.1 Implement a class Employee. An employee has a name (a string) and a salary (a double). Provide a constructor with two parameters

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. Sample usage:

Employee harry = new Employee("Hacker, Harry", 50000); harry.raiseSalary(5); // Harry gets a 5% raise

3.2 Supply an EmployeeTester class and test the Employee class as follows. Declare an Employee object for Smith, John with salary of $75406.25.

Print out the name and salary of this employee.

Ask user how much percentage should the employees salary to be raised? Input 2.5 for 2.5% raise.

Print out the name and salary of this employee. You should use formatted print and round the salary to the nearest cent.

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!