65 lines
1.3 KiB
Java
65 lines
1.3 KiB
Java
public class Alligner{
|
|
private int jour;
|
|
private int mois;
|
|
private int annee;
|
|
|
|
public Alligner(){
|
|
this.jour = 14;
|
|
this.mois = 02;
|
|
this.annee = 2023;
|
|
}
|
|
public lendemain(){
|
|
if(this.mois != 2){
|
|
if (this.jour == 30){
|
|
if(this.mois<=7){
|
|
if(this.jour%2 == 0){
|
|
this.jour = 1;
|
|
}
|
|
else{
|
|
this.jour += 1;
|
|
}
|
|
}
|
|
if(this.mois >= 8){
|
|
if(this.jour%2 == 0){
|
|
this.jour +=1
|
|
}
|
|
else{
|
|
this.jour = 1;
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
else{
|
|
if (this.jour == 28){
|
|
this.jour == 1;
|
|
}
|
|
else{
|
|
this.jour +=1;
|
|
}
|
|
}
|
|
if(this.jour == 31){
|
|
this.jour == 1;
|
|
}
|
|
if (this.jour ==1){
|
|
if(this.mois !=12){
|
|
this.mois+=1;
|
|
}
|
|
else{
|
|
this.mois = 1;
|
|
this.annee +=1;
|
|
}
|
|
}
|
|
}
|
|
public String toString(){
|
|
/*if(this.jour <10){
|
|
return Integer.toString(this.annee) +"-" + Integer.toString(this.mois) + "-0" + Integer.toString(this.jour);
|
|
}
|
|
if(this.mois <10){
|
|
return Integer.toString(this.annee) +"-0" + Integer.toString(this.mois) + "-" + Integer.toString(this.jour);
|
|
}
|
|
if(this.annee < 1000){
|
|
return "0" + Integer.toString(this.annee) +"-" + Integer.toString(this.mois) + "-" + Integer.toString(this.jour); */
|
|
return Integer.toString(this.annee) +"-" + Integer.toString(this.mois) + "-" + Integer.toString(this.jour);
|
|
}
|
|
} |