Assignment Course: Object-Oriented Programming COURSE ID: 503005
Assignment Course: Object-Oriented Programming COURSE ID: 503005
I. Introduction
A software company need to manage employees in the company. In this assignment, student needs to
implement some modules in the employee management system. The main objects that need to be
managed are Developer and Tester.
Feature that students need to implement are:
- Read file that contains employee list
- Return employee list that is filtered by specific criteria
- Return employee that is filtered by specific criteria
- Sort employee list
II. Resource
The initial source code has the following files:
- Input file and expected output:
o The input folder contains ListOfEmployees.txt: employee list data, PLInfo.txt: contains
programming languages that employees specialize in
o The output folder contains: 5 files named Req2.txt, Req3.txt, Req4.txt, Req5.txt,
Req6.txt contain expected output of the requirement in the assignment
- Source code file:
o TestCM.java: creates object instance and calls methods that students need to implement
o Employee.java: contains predefined Employee class. Students must not edit this file
o CompanyManagement.java: contains predefined CompanyManagement class that has
property empList (contain employee list), constructor, write file method and many empty
methods. Students need to implement the code for these empty methods and must not edit
predefined methods.
III. Order of doing the assignment
- Students download and extract the given resource files.
- In the same folder of 03 given .java file, students need to create 03 more files corresponding to 3
classes: Developer, Tester, TeamLeader
- Students must complete Developer, Tester, TeamLeader and CompanyManagement class
according to the requirement in the next part.
- After implementing needed methods in the CompanyManagement class, students need to
compile and run the main method in the TestCM.java file that has calls to invoke those methods.
Students implement the solutions according to the requirement and compare the output result
with the expected output in the output folder.
- For requirement that students can’t implement, please don’t remove the methods associated with
those requirements and make sure that the program still runs correctly.
IV. Employee, Developer, Tester, TeamLeader class description
- Developer and Tester class inherit from Employee class, TeamLeader class inherits from
Developer class.
- Properties and methods description:
o Employee class:
▪ empID: Employee ID
▪ empName: Employee name
▪ baseSal: Base salary of employees
▪ abstract method getSalary()
▪ toString(): return string of the format: empID_empName_baseSal
o CompanyManagement class:
▪ empList: an ArrayList to contains Employee list.
▪ CompanyManagement(String path, String path1): Constructor, create empList
by calling the read file method.
▪ getEmployeeFromFile(String path, String path1): Read from file to empList
with path is the path to the ListOfEmployees.txt file which contains employee list
and path1 is the path to the PLInfo.txt file which contains the programming
language list that employees specialize in.
▪ getDeveloperByProgrammingLanguage(String pl): return the list of
developers that satisfies the programming language pl.
▪ getTestersHaveSalaryGreaterThan(double value): return the list of testers that
has the total salary greater than the value.
▪ getEmployeeWithHighestSalary(): return the employee that has the highest
salary.
▪ getLeaderWithMostEmployees(): return the leader of the group with the most
employees.
▪ sorted(): return the sorted employee list empList.
▪ printEmpList(): print empList employee list to the command prompt.
▪ writeFile(String path, ArrayList<E> list): write to file the list of employees
( students must not edit this method).
▪ writeFile(String path, E object): write to a file a generic object (students must
not edit this method).
o Developer class:
▪ teamName: the name of the team. One developer can only belong to one team.
▪ programmingLanguages: the list of programming languages that developers adept
in
▪ expYear: developer year of experience
▪ getSalary(): return salary, will be described below
▪ toString(): return a string of the following format:
empID_empName_baseSal_teamName_programmingLanguages_expYear
With programmingLanguages must be in this format:
[programmingLanguages1, programmingLanguages2, ...]
(Student can check the expected output file for understanding the correct format)
o Tester class:
▪ bonusRate: percentage bonus increase .
▪ type: type of tester (Automation Test - AM/Manual Test - MT).
▪ getSalary(): return salary, will be described below.
o TeamLeader class: TeamLeader is also a Developer, one group can only have 01
TeamLeader.
▪ bonus_rate: percentage bonus increase.
▪ getSalary(): return salary, will be described below.
- Salary calculation description
o Developer
▪ 5 years of experience:
Salary = base salary + years of experience * 2.000.000 (2 millions)
▪ 5 > years of experience >= 3:
Salary = base salary + years of experience * 1.000.000 (1 million)
▪ The remaining cases:
Salary = base salary
o TeamLeader
▪ If Developer is TeamLeader will have bonus increase:
Salary = developer salary + bonus increase * developer salary
(Developer salary is the salary of the developer)
o Tester
Salary = base salary + bonus increase * base salary
o TeamLeader
OrderNo.,Employee ID,Employee name,Team name,Years of experience,The character
“L” indicates TeamLeader,Bonus increase,Base salary
o Tester
OrderNo.,Employee ID,Employee name,Bonus increase,Type of tester,Base salary
o Tester
empID_empName_baseSal
Note:
- Students can add samples to the input file to test many different cases but remember to keep the
samples in the right format.
- Students should carefully read the main method to figure out the way to implement classes and
methods.
- Students can add custom methods to the main method to test the implemented methods but make
sure that your implementation can be run on the main method which is provided in original.
- Students can add custom methods but make sure that your implementation still works with the
given TestCM.java file .
- Do not edit the name of the predefined method (follow the class diagram).
VI. Requirement
1. Requirement 1
The method printEmpList() is by default called by the main method, if students implement the
getEmployeeFromFile() method correctly, then the list of employees will be printed to the command
prompt when the program is ran.
Note: This is the method that students must implement to start getting points. If you can’t get the list of
Employee instances from the input file then you will not be able to get points from the requirement
below.
All the requirement below is based on interacting with the empList list
2. Requirement 2
Implement method:
public ArrayList<Developer> getDeveloperByProgrammingLanguages(String pl)
return the list of developers adept in the programming language pl. Knowing that the pl argument
always contains only 1 programming language by String.
3. Requirement 3
Implement method:
public ArrayList<Tester> getTestersHaveSalaryGreaterThan(double value)
return the list of testers that have salary greater than the specified value. For example, if the value is
5.000.000 then the returned list of testers must have salary greater than 5.000.000
4. Requirement 4
Implement method:
public Employee getEmployeeWithHighestSalary()
return Employee with the highest salary in the list. If there are equal salaries, return the last person with
the highest salary in the list
5. Requirement 5
Implement method:
public TeamLeader getLeaderWithMostEmployees()
return the TeamLeader that has the most members in the team. If there are equal members case, return
the TeamLeader with the higher years of experience. (Testcase will not have any cases outside the
described case above). Knowing that, one group can only have 1 TeamLeader and one Developer can
only belong to 1 team.
6. Requirement 6
Implement method:
public ArrayList<Employee> sorted()
return the list of employees that is sorted by descending order of salary. If there are equal salary cases,
sort by the first letter (alphabet order) of the employee name (name is the last word in employee full
name). The sorting of employee list is done on a new list of Employee cloned from empList list
(Testcase will not have cases that contain employees with the same salary and the same first letter)
If you implement the methods correctly from Requirement 2 to Requirement 6, when the main method
run, you will get 5 files have the contents same with the samples in output folder.
VII. Note before submission
- For the methods that students can’t implement, please leave it as provided. DO NOT DELETE
THE METHOD OF REQUIREMENT, it will lead to error when running the main method.
Before submission, please check if your program runs correctly with the provided main method.
- All files ReqX.txt (X = {2,3,4,5,6}) must be in the same directory with the directory that
contains the source code. For students that use IDE (Eclipse, Netbeans, …) must ensure that file
can be ran with command prompt, must not be in any package, the position of the output file
ReqX.txt must be in the same directory with the code file.
- The correct output file position when running the program:
-- THE END --