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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
| package Basic;
import java.util.Scanner;
public class Farenheit {
public static void main(String[] args) {
// TODO Auto-generated method stub
int init=0,max=0,pas=0;
double far;
String rep1, rep2;
Scanner scan = new Scanner(System.in);
double coeff = 9.0/5.0;
System.out.println("CONVERSION DE DEGRES CELSIUS EN DEGRES FARHENHEIT");
do {
do {
// Demande Initialisation des bornes
init= 0;
max= 0;
pas = 0;
System.out.println("A partir de : ");
init = Integer.parseInt(scan.nextLine());
System.out.println("Jusqu'à : ");
max = Integer.parseInt(scan.nextLine());
System.out.println("Par pas de : ");
pas = Integer.parseInt(scan.nextLine());
System.out.println("Assurez-vous que l'imprimante est prête");
System.out.println("Si vous êtes sur des bornes tapez(O/N)");
rep1 = scan.nextLine();
}
while (rep1 == "N" || rep1 =="n");
// Fin boucle Tant que réponse "êtes vous sur des bornes" !=O
System.out.println("Table de conversion de degrés Celsius en degrés Farhenheit");
System.out.println("Celsius Farhenheit");
for (int i = init; i < max+1; i=i+pas) { // Conversion des valeurs pour les bornes init et max données
far = (coeff*i + 32);
System.out.println(+i+ " "+ far);
} // Fin boucle For
System.out.println("Souhaitez vous éditer une autre table ? (O/N)");
rep2 = scan.nextLine();
} while (rep2=="O" || rep2=="o") ; // Fin boucle éditer une table
System.out.println("Au revoir et à bientôt !");
scan.close();
}
} |