0% found this document useful (0 votes)
44 views

Assignment 5 - 6

1) The document describes an assignment to create an EmployeeApp project that reads employee data from a file, stores it in an array of Employee objects, and implements methods to calculate average and maximum salary. 2) Students are instructed to create an Employee class with id, name, salary fields and accessors, read employee data from a file into an Employee array, prompt the user to lookup an employee by id, and call methods to get the average and maximum salary. 3) The assignment tests calculating average salary from an Employee array, finding how many employees earn more than the average, and returning the maximum salary from the array.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Assignment 5 - 6

1) The document describes an assignment to create an EmployeeApp project that reads employee data from a file, stores it in an array of Employee objects, and implements methods to calculate average and maximum salary. 2) Students are instructed to create an Employee class with id, name, salary fields and accessors, read employee data from a file into an Employee array, prompt the user to lookup an employee by id, and call methods to get the average and maximum salary. 3) The assignment tests calculating average salary from an Employee array, finding how many employees earn more than the average, and returning the maximum salary from the array.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Rachida Amjoun CSD 3464 Java Programming SE

Assignment 5-6 (5%)

In this assignment, you will be implementing a program that use array to Store and Process Data from file
and you will write few methods
Attached the file “Employee.txt” which contains ids, names and the salary of 5 employees.
Part 1:
1. Create a java project named EmployeeApp.
2. Create a new class named Employee with the following private data fields: id, name, salary.
3. Add constructors, getters and setters.

Part 2:

In main method:

4. Open the file for reading


5. Create an array of Employee objects. Read the data of each employee and assigned to appropriate
field.
6. Close the file.
7. Prompt the user to enter employee ID then display his salary.
If the employee Id does not exist display “Employee is not found”, and ask the user to enter the
Id again.
8. In test class (where the main method is added):
Create the following methods:
 getAverageSalaries accepts Employee object array as argument and return the average of
salaries
 getMaxSalary accepts Employee object array as argument and return the maximum
element.

In main Method:

9. Call getAvrageSalaries method and display the returned average


10. Find how many employees have a salary greater than the average salary

You might also like