{ //program starts here { final double INCH_PER_FT = 12.0; int ft; double inch; String str = null; DecimalFormat twoPrec = new DecimalFormat("0.00"; str = JOptionPane.showInputDialog("This program converts feet into inches.\n"+"Enter a whole number in feet: "); ft = Integer.parseInt( str ); inch = * INCH_PER_FT ; System.out.println(ft + " feet equals " + twoPrec.format(inch) + "inches"); JOptionPane.showMessageDialog(null, ft + "feet equals " + twoPrec.format(inch) + " inches", "Output", JOptionPane.PLAIN_MESSAGE); System.exit(0); } }
Site hosted by Angelfire.com: Build your free website today!