import java.util.Scanner; public class Esercizio4 { public static void main(String[] args) { Scanner tastiera = new Scanner(System.in); System.out.print("Inserire una temperatura seguita da C per Celsius ed F per Fahrenheit: "); double temp = tastiera.nextDouble(); String tipo = tastiera.next(); switch (tipo) { case "C": case "c": double gradiF = (9 * temp / 5) + 32; System.out.println("La temperatura in gradi Fahrenheit è " + gradiF); break; case "F": case "f": double gradiC = 5 * (temp - 32) / 9; System.out.println("La temperatura in gradi Celsius è " + gradiC); break; default: System.out.println("Hai inserito un tipo di temperatura errato"); } tastiera.close(); } }