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 28 29 30 31 32 33 34 35
| import java.util.Scanner;
public class temperature {
/**
* @param args
*/
public static void main(String[] args) {
int choix;
float temperature;
char choix2;
Scanner reponse = new Scanner(System.in);
{
System.out.println("Choix 1/ F->C ; 2/ C->F");
choix = reponse.nextInt();
System.out.println("Quelle température ?");
temperature = reponse.nextFloat();
reponse.nextLine();
if(choix==1){
System.out.println("En C :"+temperature * 2.0);
}else{
System.out.println("En F :"+temperature / 2.0);
}
System.out.println("\n C'était cool. Encore (O/N)?");
choix2 = reponse.nextLine().charAt(0);
}while(choix2 == 'O');
System.out.println("\n Bye !");
}
} |