programmazione-java/src/AziendaExtends/Presenze.java

32 lines
718 B
Java
Raw Permalink Normal View History

2016-11-18 18:06:16 +00:00
import java.util.Scanner;
2016-11-19 10:46:30 +00:00
public class Presenze{
2016-11-18 18:06:16 +00:00
2016-11-19 10:46:30 +00:00
public Presenze(int oreLavoro, String codiceFiscale){
2016-11-18 18:06:16 +00:00
this.oreLavoro=oreLavoro;
this.codiceFiscale=codiceFiscale;
}
2016-11-19 10:46:30 +00:00
public static Presenze read(Scanner sc) throws Exception{
2016-11-18 18:06:16 +00:00
String codiceFiscale;
int oreLavoro;
if(!sc.hasNext()) return null;
codiceFiscale=sc.next();
if(!sc.hasNextInt()) return null;
oreLavoro=sc.nextInt();
2016-11-19 10:46:30 +00:00
return new Presenze(oreLavoro, codiceFiscale);
2016-11-18 18:06:16 +00:00
}
public int getOreLavoro(){
return oreLavoro;
}
public String getCodiceFiscale(){
return codiceFiscale;
}
private int oreLavoro;
private String codiceFiscale;
}