Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args)
- {
- Scanner sc = new Scanner (System.in);
- String choix = "";
- String reponse = "";
- do {
- System.out.println("Quel est la température à calculer ?");
- int temperature = sc.nextInt();
- System.out.print("Désirez vous 1.convertir de °C à far ou 2.de far en °C");
- sc.nextLine();
- reponse.equals(sc.nextLine());
- do{
- if (reponse.equals("1")){
- temperature = 9/5*temperature+33;
- System.out.print("Cela correspond à " +temperature +"°F");
- }else if(reponse == "2"){
- temperature = ((temperature-32)*5)/9;
- System.out.print("Cela correspond à " +temperature +"°C");
- }else{
- System.out.print("Tu dois répondre 1 ou 2, pas autre chose, recommence");
- }
- }while(!reponse.equals("1")||!reponse.equals("2"));
- System.out.println("Voulez vous recommencer ?(0/N)");
- choix = sc.nextLine();
- }while(!choix.equals("N"));
- sc.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement