/* * Diametro.java * * Created on August 16, 2005, 1:58 PM * * To change this template, choose Tools | Options and locate the template under * the Source Creation and Management node. Right-click the template and choose * Open. You can then make changes to the template in the Source Editor. */import javax.swing.JOptionPane;/** * * @author zapa */public class Diametro { /** Creates a new instance of Diametro */ public static void main ( String args[]) { //Definimos las variables double diametro, cirncunferencia; // Pedimos el Radio double radio, area; // Capturamos el radio String radioCapturado; String resultado; radioCapturado = JOptionPane.showInputDialog( "Dame el radio"); radio = Double.parseDouble( radioCapturado ); diametro = radio*2; cirncunferencia = Math.PI * (2 *radio); area = Math.PI * (radio*radio); resultado = "Diametro = " + String.valueOf(diametro) + "\n"; resultado = resultado + " Cirncunferencia = " + String.valueOf(cirncunferencia); resultado = resultado + " Area = " + String.valueOf(area); // resultado = ""; JOptionPane.showMessageDialog(null, resultado, "Resultados de la operacion matematica.", JOptionPane.INFORMATION_MESSAGE ); System.exit( 0 ); }}