All pastes #2103878 Raw Edit

Something

public text v1 · immutable
#2103878 ·published 2012-01-18 19:11 UTC
rendered paste body
import 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 + "!");
	
	}

}