9 File IO and grouping
-
If needed, retrieve the OOP Company project up to chapter 8 from DLO. It contains the classes as you left them at the end of chapter 8.
-
Create a
Datafolder in the same folder as your src folder. -
Download the files
Departments.txtandPeople.csvfrom DLO and place them in theDatafolder. -
Read the departments from the text file
Departments.txtand add them to a list nameddepartments. Note: the name and location of the department are on two different lines in the text file. -
Read the various persons from the file
People.csvand add them to a list namedpeople. A line consists of: person type, name, city, index of the departments list, monthly salary / hourly rate / 0. -
Sort the list of persons and print them.
-
Add code to create an output file
PeoplePerDepartment.txtthat looks like this (grouped by department):1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Department: Operations -- Ambi lives in Amsterdam and works at department Operations at Hilversum and is a volunteer -- Anne lives in Zwolle and works at department Operations at Hilversum and is a freelancer with an hourly rate of 40.0 -- Jannie lives in Utrecht and works at department Operations at Hilversum and is a freelancer with an hourly rate of 60.0 -- Ronald lives in Zaandam and works at department Operations at Hilversum and is a freelancer with an hourly rate of 80.0 Department: Support -- Caroline lives in Delft and works at department Support at Amsterdam and is an employee without right to a bonus -- Naledi lives in Gaborone and works at department Support at Amsterdam and is a volunteer Department: Management -- Angelique lives in Rotterdam and works at department Management at Almere and is an employee with right to a bonus -- Ceren lives in Istanboel and works at department Management at Almere and is a volunteer -- Mark lives in Den Haag and works at department Management at Almere and is an employee with right to a bonus Department: Documentation -- Haining lives in Shaoxing and works at department Documentation at Gouda and is a volunteer -- Klaas lives in Diemen and works at department Documentation at Gouda and is a freelancer with an hourly rate of 50.0