Prueba de objetos en java

Solo disponible en BuenasTareas
  • Páginas : 2 (262 palabras )
  • Descarga(s) : 0
  • Publicado : 23 de noviembre de 2010
Leer documento completo
Vista previa del texto
/*
* CGeometria.java
*
* Created on 22 de octubre de 2010, 10:54
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

packageobjetosgeometria;

/**
*
* @author Juan Carlos del Olmo
*/

public class CGeometria {
private double cordx;
private double cordy;
final static double pi=3.1415926;

/**Creates a new instance of CGeometria */
public CGeometria(double cx, double cy) {
cordx=cx;
cordy=cy;
}

public void modificaCordenadaX(double newX){cordx=newX;
}

public void modificaCordenadaY(double newY){
cordy=newY;
}


}

/*
* CGeometriaCirculo.java
*
* Created on 22 de octubre de 2010, 10:55
*
*To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package objetosgeometria;

/**
*
* @author Juan Carlos del Olmo
*/

public classCGeometriaCirculo extends CGeometria {
private double radio;
private double area;
private double perimetro;


/** Creates a new instance of CGeometriaCirculo */public CGeometriaCirculo(double rd, double cx, double cy) {
super(cx, cy);
radio=rd;
}

public double dameArea(){
area=pi*(radio*radio);
return area;}

public double damePerimetro(){
perimetro=2*pi*radio;
return perimetro;
}


public void modificaRadio(double newR){
radio=newR;
}}

/*
* CGeometriaCuadrado.java
*
* Created on 22 de octubre de 2010, 10:56
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.*/

package objetosgeometria;

/**
*
* @author Juan Carlos del Olmo
*/

public class CGeometriaCuadrado extends CGeometria {
private double ladoC1;
private double ladoC2;...
tracking img