/** * This program will get a weight in pounds from the user and convert it to Kilograms. * * */ import javax.swing.JOptionPane; import java.text.DecimalFormat; class PoundsToKilograms{ public static void main(String [] args){ // prompt String input = JOptionPane.showInputDialog("Enter Weight"); double weight = Double.parseDouble(input); double convertedWeight = weight / 2.2; DecimalFormat fmt = new DecimalFormat("0.000"); System.out.println(weight + " pounds converted to Kilograms is " + fmt.format(convertedWeight)); } }