The code below return annee;
won't be executed.
It looks like you want to return 3 values. You can only return 1 value, a double
in this case.
Solution 1 (Global variables):
int annee, semaine, jour; //global variables
public void Convertir(int Number) { //I guess number should be an Int too, unless it's possible to pass 567.28 days...
//Number = nombre; Useless since this is a parameter
annee = (int)(Number/365);
semaine = (int)((Number - annee * 365)/7);
jour = Number - annee * 365 - semaine * 7;
}
Solution 2 (return an array):
public int[] Convertir(int Number) { //I guess number should be an Int too, unless it's possible to pass 567.28 days...
//Number = nombre; Useless since this is a parameter
int[] anneeSemaineJour = new int[3];
anneeSemaineJour[0] = (int)(Number/365);
anneeSemaineJour[1] = (int)((Number - anneeSemaineJour[0] * 365)/7);
anneeSemaineJour[2] = Number - anneeSemaineJour[0] * 365 - anneeSemaineJour[1] * 7;
return anneeSemaineJour;
}
You will then use it like this (Solution 2):
int[] resultat = convertir(822); // convertir(nombre) in your case I guess
System.out.println("Annee = " + resultat[0] + " Semaine = " + resultat[1] + " Jour = " + resultat[2]);