import javax.swing.*; public class perimeterDialog { public static void main(String[] args) { String input, output; double length, width, perimeter; input = JOptionPane.showInputDialog("Length of box:"); length = Double.parseDouble(input); input = JOptionPane.showInputDialog("Width of box"); width = Double.parseDouble(input); perimeter = 2 * length + 2 * width; output = String.format("For the box with length %.2f%n", length) + String.format("and width %.2f%n", width) + String.format("the perimeter is %.2f%n", perimeter); JOptionPane.showMessageDialog(null, output, "Perimeter of the box.", JOptionPane.INFORMATION_MESSAGE); System.exit(0); } }