public class SentCon3 {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);

		double input;
		char choice;
		System.out.println("**** Menu-Driven Temperature Converter*****");
		System.out.println("only lowwer case is vaild");
		System.out.print("Enter the value to beconverted==> ");
		input = scan.nextDouble();
		System.out.println("What is your choice?");
		System.out.println("a)Fahrenheit to Celsius");
		System.out.println("b)Celsius to Fahrenheit");
		System.out.println("c)Kelvin to Celsius");
		System.out.println("d)Celsius to Kelvin");
		System.out.println("e)Kelvin to Fahrenheit");
		System.out.println("f)Fahrenheit to Kelvin.");
		System.out.print("Please enter your choice ==>");
		choice = scan.next().charAt(0);

		while (choice == 'a') {
			System.out.println((input / 5) * 9 + 32);
			break;
		}
		while (choice == 'b') {
			System.out.println((input - 32) * 5 / 9);
			break;
		}
		while (choice == 'c') {
			System.out.println(input - 273.15);

			break;
		}
		while (choice == 'd') {
			System.out.println(input + 273.15);
			break;
		}
		while (choice == 'e') {
			System.out.println((input - 273.5) * 9 / 5 + 32);
			break;
		}
		while (choice == 'f') {
			System.out.println((input + 459.67) * 5 / 9);
			break;
		}

	}

}

use while as if!!!!

By person, 2020-10-13 03:01:18