Commit 759da731 by Patryk Czarnik

zadania rozwiązane "proceduralnie" - poprawki

parent 3c74648b
......@@ -21,6 +21,10 @@ public class ObslugaCSV {
String linia;
while((linia = reader.readLine()) != null) {
String[] t = linia.split(";", -1);
// psucie danych, aby sprawdzić porównania z nullem
// if(t[1].charAt(0) == 'A') {
// t[3] = null;
// }
Employee emp = new Employee(Integer.parseInt(t[0]),
t[1], t[2], t[3], Integer.parseInt(t[4]),
LocalDate.parse(t[5]), t[6], t[7], t[8], t[9], t[10]);
......
......@@ -9,7 +9,7 @@ public class P2_WypiszBogatych {
int ile = 0;
for(Employee emp : emps) {
if(emp.getSalary() >= 10_000) {
System.out.printf("Pracownik %s %s (%s) zarabia %d i pracuje w %s.\n",
System.out.printf("%s %s (%s) zarabia %d i pracuje w %s.\n",
emp.getFirstName(), emp.getLastName(), emp.getJobTitle(), emp.getSalary(), emp.getCity());
ile++;
}
......
......@@ -6,11 +6,11 @@ public class P3_SredniaWszystkich {
public static void main(String[] args) {
List<Employee> emps = ObslugaCSV.wczytaj();
double suma = 0;
int suma = 0;
for(Employee emp : emps) {
suma += emp.getSalary();
}
double srednia = suma / emps.size();
double srednia = (double)suma / emps.size();
System.out.println("Średnia wszystkich: " + srednia);
}
......
......@@ -2,7 +2,7 @@ package emps;
import java.util.List;
public class P4_SredniaWybranych1 {
public class P4a_SredniaWybranych {
public static void main(String[] args) {
List<Employee> emps = ObslugaCSV.wczytaj();
......@@ -15,7 +15,7 @@ public class P4_SredniaWybranych1 {
}
}
double srednia = suma / ile;
System.out.println("Średnia progrmaistów: " + srednia);
System.out.println("Średnia programistów: " + srednia);
}
}
......@@ -5,7 +5,7 @@ import java.util.Objects;
import javax.swing.JOptionPane;
public class P4_SredniaWybranych2 {
public class P4b_SredniaWybranych {
public static void main(String[] args) {
String szukanyJob = JOptionPane.showInputDialog("Podaj nazwę stanowiska");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment