uouo
This commit is contained in:
1 parent
183736b4e6
commit
ab5c3ee991
13 files changed
+305
No files matched your search
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package intro.persona;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Impiegato extends Persona{
|
||||
private int salary;
|
||||
|
||||
public Impiegato(String name, Date dateOfBirth, int salary) {
|
||||
super(name, dateOfBirth);
|
||||
this.salary = salary;
|
||||
}
|
||||
|
||||
public int getSalary() {
|
||||
return salary;
|
||||
}
|
||||
|
||||
public void setSalary(int salary) {
|
||||
this.salary = salary;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package intro.persona;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Persona {
|
||||
private String name;
|
||||
|
||||
public Persona(String name, Date dateOfBirth) {
|
||||
this.name = name;
|
||||
this.dateOfBirth = dateOfBirth;
|
||||
}
|
||||
|
||||
private Date dateOfBirth;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Date getDateOfBirth() {
|
||||
return dateOfBirth;
|
||||
}
|
||||
|
||||
public void setDateOfBirth(Date dateOfBirth) {
|
||||
this.dateOfBirth = dateOfBirth;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package intro.persona;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class Stagista extends Impiegato {
|
||||
private int numeroPresenze;
|
||||
private int numeroIdentificativoStage;
|
||||
|
||||
public Stagista(String name, Date dateOfBirth, int salary, int numeroPresenze, int numeroIdentificativoStage) {
|
||||
super(name, dateOfBirth, salary);
|
||||
this.numeroPresenze = numeroPresenze;
|
||||
this.numeroIdentificativoStage = numeroIdentificativoStage;
|
||||
}
|
||||
|
||||
public int getNumeroPresenze() {
|
||||
return numeroPresenze;
|
||||
}
|
||||
|
||||
public void setNumeroPresenze(int numeroPresenze) {
|
||||
this.numeroPresenze = numeroPresenze;
|
||||
}
|
||||
|
||||
public int getNumeroIdentificativoStage() {
|
||||
return numeroIdentificativoStage;
|
||||
}
|
||||
|
||||
public void setNumeroIdentificativoStage(int numeroIdentificativoStage) {
|
||||
this.numeroIdentificativoStage = numeroIdentificativoStage;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user