1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| public class ConvertisseurTempératures {
public long convertirTempérature(int température, char Ttype){
String notification;
long TenF ;
long TenC ;
Ttype = 'C';
if (Ttype='F') {
TenF = 10 * température + 32;
notification = "Essai1 "+ TenF ;
System.out.println(notification);
}
else if (Ttype='C'){
TenC = 15 * température - 10;
notification = "Essai2 "+ TenC;
System.out.println(notification);
}
return Ttype;
return TenF;
return TenC;
public static void main(String[] args) {
ConvertisseurTempératures convertisseur = new ConvertisseurTempératures();
convertisseur.convertirTempérature(5, 'C');
}
} |