uouo
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
package intro.persona;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class ImpiegatiDemo {
|
||||
public static void main(String[] args) {
|
||||
Impiegato i1 = new Impiegato("Dio cane", new Date(1990, Calendar.MARCH,8), 1200);
|
||||
Impiegato i2 = new Impiegato("wewe ciruzz", new Date(1990, Calendar.MAY,10),2000);
|
||||
Stagista s1 = new Stagista("pepp o stagist", new Date(1999, Calendar.DECEMBER, 15), 1000,0,15);
|
||||
Stagista s2 = new Stagista("toni il fantino", new Date(1996, Calendar.NOVEMBER, 8), 1000,10,15);
|
||||
Stagista s4 = new Stagista("gennarino tricketrack", new Date(1996, Calendar.APRIL, 18), 1000,5,15);
|
||||
Stagista s3 = new Stagista("peppiniell junior", new Date(2000, Calendar.JULY,1),1000,1,16);
|
||||
Stagista s5 = new Stagista("pascalin o femminiell", new Date(2000, Calendar.JANUARY,28),1000,2,16);
|
||||
|
||||
List<Impiegato> list = new ArrayList<>();
|
||||
|
||||
list.add(i1);
|
||||
list.add(i2);
|
||||
list.add(s1);
|
||||
list.add(s2);
|
||||
list.add(s3);
|
||||
list.add(s4);
|
||||
list.add(s5);
|
||||
|
||||
Impiegato g = cercaGiovane(list);
|
||||
System.out.println(g.getName());
|
||||
}
|
||||
|
||||
public static Impiegato cercaGiovane(List<Impiegato> list) {
|
||||
Impiegato tmp = list.get(0);
|
||||
for (Impiegato i: list) {
|
||||
if (tmp.getDateOfBirth().before(i.getDateOfBirth())) {
|
||||
tmp = i;
|
||||
}
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user