// Worksheet 4 // #5 import java.util.Scanner; class ConvertTemp { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Choose (C/F): "); String choice = input.next(); if(choice.equalsIgnoreCase("C")) { System.out.print("Temp. in Celsius: "); double cel = input.nextDouble(); double fah = 9.0/5 * cel + 32; System.out.println("Temp. in Fahrenheit: " + fah); } else if(choice.equalsIgnoreCase("F")) { System.out.print("Temp. in Fah.: "); double fah = input.nextDouble(); double cel = 5.0/9 * (fah - 32.0); System.out.println("Temp. in Celsius: " + cel); } } }