Netbeans - Ayuda para el calculo del area de un circulo

 
Vista:
sin imagen de perfil

Ayuda para el calculo del area de un circulo

Publicado por perla lizbeth (1 intervención) el 04/05/2015 20:09:00
ESTE CODIGO ES PARA CALCULAR EL AREA DE 4 FIGURAS GEOMETRICAS UN CUADRADO, UN TRIANGULO, UN RECTANGULO Y UN CIRCULO, SELECCIONAR LA FIGURA CON UN RADIOBUTTON Y SELECCIONAR LO QUE SE DESEA CALCULAR CON UN CHECKBOX Y EL RESULTADO SE ENVIA A OTRA VENTANA JFRAME Y SE IMPRIME BIEN EL PROBLEMA ES QUE FUNCIONA EL CALCULO DE TODAS LAS FIGURAS MENOS LA DEL CIRCULO Y YA INTENTE DE UNA Y MIL FORMAS Y NO SE CUAL ES EL PROBLEMA Y SI EL CODIGO DEL CIRCULO LO PONGO ANTES QUE EL CODIGO DE LAS DEMAS SI EJECUTA PERO LAS DEMAS NO Y VICEVERSA SI LO PONGO AL FINAL TODAS EJECUTAN MENOS EL CIRCULO ESPERO HABERME EXPLICADO Y AUN MAS AGRADECERIA MUCHO A QUIEN PUDIERA BRINDARME SU AYUDA DE VERDAD ME URGE


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
private void calcularActionPerformed(java.awt.event.ActionEvent evt) {
RESULTADO forma=new RESULTADO();
 
double ba,h,ar = 0,per = 0;
double radi;
if(cuadrado.isSelected()==true)
forma.f="cuadrado";
ba=Double.parseDouble(base.getText());
if(area.isSelected()==true)
ar=ba*ba;
forma.a=forma.a=ar;
if(perimetro.isSelected()==true)
per=ba*4;
forma.p=forma.p=per;
forma.setVisible(true);
this.dispose();
 
if(rectangulo.isSelected()==true)
forma.f="rectangulo";
ba=Double.parseDouble(base.getText());
h=Double.parseDouble(altura.getText());
if(area.isSelected()==true)
ar=ba*h;
forma.a=forma.a=ar;
if(perimetro.isSelected()==true)
per=(ba*2)+(h*2);
forma.p=forma.p=per;
forma.setVisible(true);
this.dispose();
 
 
if(triangulo.isSelected()==true)
forma.f="triangulo";
ba=Double.parseDouble(base.getText());
h=Double.parseDouble(altura.getText());
if(area.isSelected()==true)
ar=(ba*h)/2;
forma.a=forma.a=ar;
if(perimetro.isSelected()==true)
per=(h*2)+ba;
forma.p=forma.p=per;
forma.setVisible(true);
this.dispose();
 
if(circulo.isSelected()==true)
forma.f="circulo";
radi=Double.parseDouble(radio.getText());
if(area.isSelected()==true)
ar=(radi*radi)*3.1416;
forma.a=forma.a=ar;
if(perimetro.isSelected()==true)
per=(radi*2)*3.1416;
forma.p=forma.p=per;
 
forma.setVisible(true);
this.dispose();
 
 
 
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder