Design a class named Employee_Salary that contains: • A String data field named name representing the name of the employee. • A String data field named position representing the position of the employee • A double data field named salary representing the salary of the employee. • A constructor with the parameters that initialize the name, position, and salary. • A method named printInfo () to print the employees details (name, position, and salary) Write a test program that creates an array of object to hold 5 employees object from employee class. Assign values to the object. Calculate the salary average, then find how many employees have a salary less than the average and how many employees have a salary greater than the average. Calling printInfo method to display the information of all employees and show the number of employees have a salary less than the average and the number of employees have a salary greater than the average.
Design a class named Employee_Salary that contains:
• A String data field named name representing the name of the employee.
• A String data field named position representing the position of the employee
• A double data field named salary representing the salary of the employee.
• A constructor with the parameters that initialize the name, position, and salary.
• A method named printInfo () to print the employees details (name, position, and
salary)
Write a test program that creates an array of object to hold 5 employees object from employee class. Assign values to the object. Calculate the salary average, then find how many employees have a salary less than the average and how many employees have a salary greater than the average. Calling printInfo method to display the information of all employees and show the number of employees have a salary less than the average and the number of employees have a salary greater than the average.
Step by step
Solved in 2 steps with 2 images