Box.java 855 Bytes
Newer Older
Joel Florentin committed
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
public class Box {
    private float ancho;
    private float largo;
    private float profundidad;


    public void calcularVolumen() {
        System.out.println(this.ancho*this.largo*this.profundidad);
    }

    public float getAncho() {
        return ancho;
    }

    public float getLargo() {
        return largo;
    }

    public float getProfundidad() {
        return profundidad;
    }

    public void setAncho(float ancho) {
        this.ancho = ancho;
    }

    public void setLargo(float largo) {
        this.largo = largo;
    }

    public void setProfundidad(float profundidad) {
        this.profundidad = profundidad;
    }

    public static void main(String[] args) {
        Box box = new Box();
        box.setAncho(3.5f);
        box.setLargo(7.3f);
        box.setProfundidad(2.5f);
        box.calcularVolumen();
    }

}