/* * GUIPizza.java * * Created on February 1, 2002, 12:10 PM */ import javax.swing.*; /** * * @author redmond * @version */ public class GUIPizza { public static final double PI = 3.14159; /** Creates new GUIPizza */ public GUIPizza() { } /** * @param args the command line arguments */ public static void main (String args[]) { String priceString; priceString = JOptionPane.showInputDialog("Please enter the price of the pizza:"); double price; price = Double.parseDouble(priceString); String diamString; diamString = JOptionPane.showInputDialog("Please enter the diameter of the pizza in inches:"); double diameter; diameter = Double.parseDouble(diamString); double radius = diameter / 2; double area = radius * radius * PI; double costPer = price / area; JOptionPane.showMessageDialog(null,"Results \n" + " Diameter: " + diameter + "\n" + " Radius: " + radius + "\n" + " Area: " + area + "\n" + " Price: " + price + "\n" + "\n" + " Cost Per Sq Inch: " + costPer); System.exit(0); } }