Commit 804288b8 by Patryk Czarnik

hakowanie ocen

parent 86c33711
package p11_klasy.enkapsulacja; package p11_klasy.enkapsulacja;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List;
public class Program { public class Program {
...@@ -19,12 +20,15 @@ public class Program { ...@@ -19,12 +20,15 @@ public class Program {
student.dodajOcene(3); student.dodajOcene(3);
student.dodajOcene(5); student.dodajOcene(5);
student.dodajOcene(3); student.dodajOcene(3);
student.dodajOcene(5);
student.dodajOcene(3);
student.dodajOcene(3);
student.dodajOcene(4);
System.out.println("oceny: " + student.getOceny()); System.out.println("oceny: " + student.getOceny());
System.out.println("średnia: " + student.sredniaOcen()); System.out.println("średnia: " + student.sredniaOcen());
// próba modyfikacji listy za pośrednictwem gettera
List<Integer> lista = student.getOceny();
System.out.println(lista);
lista.removeIf(x -> x < 4); // usuń wszystkie oceny gorsze niż 4
System.out.println(lista);
System.out.println("średnia: " + student.sredniaOcen());
} }
} }
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