rendered paste bodyimport java.util.*;
public class Gram {
public static void main(String args[]) {
String strVal;
double numVal = 0;
double resultVal = 0;
final double CON_RATE = 2.2;
Scanner strIn = new Scanner(System.in);
Scanner numIn = new Scanner(System.in);
System.out.print("Kg or Lb: ");
strVal = strIn.nextLine();
if(strVal.equals("Kg")) {
System.out.print("Enter the value: ");
numVal = numIn.nextDouble();
resultVal = (numVal / CON_RATE);
} else if(strVal.equals("Lb")) {
resultVal = (numVal * CON_RATE);
} else {
System.out.println("You have entered an incorrect value.");
}
System.out.println("The conversion result is " + resultVal + "!");
}
}