Expert in study
Roy Roy Dec 11, 2020

Using a switch statement write a menu driven program to convert a given temprature to farhenhiet to celsius and vise versea for an incorrect choice an appropriate message should be displayed C=5/9​

answers: 1
Register to add an answer
The time for answering the question is over

import*; class Temp { public static void main(String arg[ ])throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(; int choice; double f=0, c=0; System.out.println(“Menu”); System.out.printing(“Fahrenheit to Celsius”); System.out.println(“2.Celsius to Fahrenheit”); System.out.println(“3.Wrong choice.Re-enter”); System.out.println(“Enter your choice(l-3):”); choice=Integer.parseInt(br.readLine()); switch(choice) { case 1 : System.out.println(“Enter the value of Fahrenheit”); f=Double.parseDouble(br.readLine()); c=5/9 * (f-32); System.out.println(“Temperature Fahrenheit to Celsius =”+c); break; case 2 : System.out.println(“Enter the value of Celsius”); c=Double.parseDouble(br.readLine()); f=1.8*(c+32); System.out.println(“Celsius to Fahrenheit =”+f); break; default : System.out.println(“Wrong choice! Re-enter”); break; } } }

Timurovich Timurovich
Dec 11, 2020
For answers need to register.
Expert in study
About us
For new users
For new experts
Terms and Conditions