Question
Can someone please write this program in Java? Thank you. Create an Employee class as per the following specifications: -three private instance variables: firstName (String),
Can someone please write this program in Java? Thank you.
Create an Employee class as per the following specifications:
-three private instance variables: firstName (String), lastName(String), and salary (double)
-a single constructor with three arguments: the first name, the last name and the salary. In the constructor, initialize the instance variables with the provided parameter values.
-get and set methods for each of the instance variables.
-A computation method, calculateSalary, that takes the percent raise as a decimal value for its argument. The method returns the new salary using the calculation: salary + salary * raise%
-A toString method to return a string containing all information stored about the employee
Using the Employee class as a parent, write a child class called Manager that inherits all methods and attributes from Employee plus contains:
-An attribute of bonus (double)
-Methods that set and get the bonus
-An appropriate constructor that will set all instance variables
-An overridden computation method, calculateSalary, that takes the percent raise as a decimal value as its argument. The method returns the new salary using the calculation: salary + salary * raisepercent + bonus
-A toString method to return a string containing all information stored about the manager.
In another class, create a driver program that will:
-Create an employee object for Bob Smith who has a current salary of $45,000.
-Create a manager object for Sally Jones who has a current salary of $65,000 and a bonus of $6,500.
-Set Bobs salary to the new calculated salary for next year based on giving him a 3% raise.
-Set Sallys salary to the new calculated salary for next year based on giving her a 5% raise.
-Use the appropriate toString methods for Bob and Sally to output their new information to the user.
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