Run the programs. Programming Review 2" and capture the input and output: ) Show all employees in your array. g) Show the average salary. h) Show the employee who earns the highest salary.
USE Main.Java file....
Step 1: Declare class Employee with fields empName and empsal.
Step 2: Define the main() method.
Step 3: Prompt and accept the number of employees from the user.
Step 4: Create an array of objects of type Employee.
Step 5: Prompt and accept the name and salary of the employees from the user.
Step 6: Iterate for loop and display the name and salary of all the employees.
Step 7: Find the sum of salaries of all the employees and divide it by number of employees to determine the average salary.
Step 8: Initialize highestSalary to 0 and iterate for loop to compare the salary of the employee with highestSalary. Update it when a value greater than the value stored in it is encountered. Display the value stored in highestSalary.
Step by step
Solved in 3 steps with 3 images