Question: java 1- Create a class called Employee that includes five instance variables, the fName (String), the IName (String), the salary (double), children (int), and education
1- Create a class called Employee that includes five instance variables, the fName (String), the IName (String), the salary (double), children (int), and education (double). 2- Your class should have a constructor that will initialize the four instance variables (fName, IName, salary, children). 3- Provide a set and a get method for each instance variable. If the monthly salary is not positive, set it to 0.0. 4- In the Employee class, create an instance method calcEducation() that will be used for calculating the education allowance for the employee based on the following: 0% in case of no children. 10% of the salary in case the No. of children 1-2. 10% means (Salary * 0.1) 20% of the salary in case the No. of children more than 2. 20% means (Salary * 0.2) . 5. Write a test class named Employee Test that demonstrates class Employee, create three instances of the class Employee, the first one with children, the second one with two children, and the third one with three children. Call the method calcEducation() in order to update the instance variable education for the three objects, and then display their information, as follows using the method printf(): Name: Ahmad Mohammad, Salary: QAR 10000. Children: 0, Education Allowance: QAR 0. Name: Nasser Ali, Salary: QAR 10000. Children: 2. Education Allowance: QAR 1000. Name: Ahmad Mohammad, Salary: QAR 10000. Children: 3. Education Allowance: QAR 2000
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
