import javax.swing.JOptionPane;
public class conversionweight
{
public conversionweight()
{
String ans;
ans = JOptionPane.showInputDialog(null, "Enter Weight in Stone.Pounds" );
double stones = Double.parseDouble(ans);
double pounds = 14 * stones;
double kilos = 0.45359237 * pounds;
JOptionPane.showMessageDialog(null, " weight in Kilos = " + kilos);
System.exit(0);
}
}
my task was to produce a program which converts stone.pounds into kilograms.
i have got this code so farr i was just wondering if there is any way of splitting up the "ans" so that i can just multiple the stones by 14 then add the pounds rather then mutliplying the stones.pounds altogether by 14.