Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

java
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

2. What process will you put in place to address conflicts?

Answered: 1 week ago