Answered step by step
Verified Expert Solution
Question
1 Approved Answer
undefined 1. Create a class called Employee that includes five instance variables, the fName (String), the IName (String), the salary (double), children (int), and education
undefined
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 0 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 O. Name: Nasser Ali, Salary: QAR 10000, Children: 2, Education Allowance: QAR 1000. Name: Ahmad Mohammad, Salary: QAR 10000, Children: 3, Education Allowance: QAR 2000Step 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