package emps.v2_obiektowo;

import java.util.List;

public class P6_MinMax_v3 {

	public static void main(String[] args) {
		List<Employee> emps = ObslugaCSV.wczytaj("emps.csv");
		Employee min = null;
		Employee max = null;
		
		for(Employee emp : emps) {
			if(max == null || emp.getSalary() > max.getSalary()) {
				max = emp;
			}
			if(min == null || emp.getSalary() < min.getSalary()) {
				min = emp;
			}
		}
		
		System.out.println("Najbogatszy: " + max.getFirstName() + " " + max.getLastName() + " " + max.getSalary());
		System.out.println("Najbiedniejszy: " + min.getFirstName() + " " + min.getLastName() + " " + min.getSalary());
	}

}
