• Matéria: Informática
  • Autor: pedrohenriquecizilio
  • Perguntado 5 anos atrás

Um laboratório cientifico precisa de um termômetro que mostre a temperatura tanto em
Celsius como em Fahrenheit. Construa um programa para este termômetro que receba o
valor e o tipo da temperatura e faça a conversão:
em Fahrenheit : TF=9/5*TC+32º
em Celsius : TC=5/9 * (TF-32º).
faça essa situação em programa Java!!!

Respostas

respondido por: rickD248
1

import java.util.Scanner;

public class brainlyTwo {

public static void main(String[] args) {

 

 Scanner in = new Scanner(System.in);

 

 double celcius;

 double fahrenheit;

 

 System.out.println("Deseja fazer a conversão :");

 System.out.println("1) Fahrenheit -> Celcius");

 System.out.println("2) Celcius -> Fahrenheit");

 int conversao = in.nextInt();

 

 if (conversao == 1) {

 

  System.out.println("Qual a temperatura em fahrenheit?");

  fahrenheit = in.nextInt();

 

  celcius = ((fahrenheit - 32) * 5/9);

 

  System.out.println(fahrenheit + "ºF = " + celcius + "ºC");

 

 }

 

 if (conversao == 2) {

 

  System.out.println("Qual a temperatura em Celcius?");

  celcius = in.nextInt();

 

  fahrenheit = ((celcius * 9/5) + 32);

 

  System.out.println(celcius + "ºC = " + fahrenheit + "ºF");

 

  }

 

 in.close();

}

}


pedrohenriquecizilio: Valeu muito obrigado !!!
rickD248: d nd man
rickD248: da melhor resposta ae pfvr
pedrohenriquecizilio: Melhor resposta
pedrohenriquecizilio: 5 estrelas
Perguntas similares