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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started