Exerc04Ex1b.java
Ler uma temperatura em graus Celsius e apresentá-la convertida em graus Fahrenheit. A fórmula de conversão é F = (9.0 * C + 160.0) / 5.0, sendo F a temperatura em Fahrenheit e a temperatura em Celsius. Dica: use a funcionalidade eval() para a entrada da temperatura. (Leia: Algoritmo | Conversão entre as escalas Celsius, Kelvin e Fahrenheit)
package capitulo4;
import java.util.Scanner;
public class Exerc04Ex1b {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Grau Celsius = ");
double celsius = sc.nextDouble();
double fahrenheit = (9.0 * celsius + 160.0) / 5.0;
System.out.printf("%6.2f °C = %6.2f °Fn", celsius, fahrenheit);
System.out.println("nTecle ENTER para sair...");
sc.nextLine();
sc.close();
}
}
