package pracownicy;

import java.util.List;

public class P6_MinMax {

	public static void main(String[] args) {
		List<Employee> emps = ObslugaCSV.wczytaj("pracownicy.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;
			}
		}
		
		if(max != null) {
			System.out.printf("Najbogatszy: %s %s (%s), $%d\n",
					max.getFirstName(), max.getLastName(), max.getJobTitle(), max.getSalary());
		}
		
		if(min != null) {
			System.out.printf("Najbiedniejszy: %s %s (%s), $%d\n",
					min.getFirstName(), min.getLastName(), min.getJobTitle(), min.getSalary());
		}
	}

}
