Codice PHP:
public class ProvaData {
private int giorno;
private int mese;
private int anno;
//////
public int getGiorno() { //accessor method
return giorno;
}
public void setGiorno(int g) { //murator method
System.out.println("giorno: " + giorno + ", mese: " + mese);
if (g > 0 && g < 32 && mese !=2 )
{
this.giorno = g;
}
else
{
System.out.println("giorno non valido");
}
}
/////
public int getMese() { // accessor method
return mese;
}
public void setMese(int mese) { // murator method
if (mese > 0 && mese < 13)
{
this.mese = mese;
}
else
{
System.out.println("mese non valido");
}
}
///////
public int getAnno() { // accessor method
return anno;
}
public void setAnno(int anno) { // murator method
if (anno > 2000 && anno < 2013)
{
this.anno = anno;
}
else
{
System.out.println("anno non valido");
}
}
}