示例#1
0
  public static void main(String[] args) {
    Ponto p1 = new Ponto();
    p1.setX(1);
    p1.setY(0);

    System.out.println(p1);

    Circulo c1 = new Circulo();
    c1.setPonto(p1);
    c1.setRaio(3);

    System.out.println(c1);

    Retangulo r1 = new Retangulo();
    r1.setPonto(p1);
    r1.setAltura(1);
    r1.setBase(2);

    System.out.println(r1);

    Quadrado q1 = new Quadrado();
    q1.setPonto(p1);
    q1.setLado(3);

    System.out.println(q1);
  }
示例#2
0
文件: Juncao.java 项目: cezaraf/jeppd
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((retanguloA == null) ? 0 : retanguloA.hashCode());
   result = prime * result + ((retanguloB == null) ? 0 : retanguloB.hashCode());
   return result;
 }
示例#3
0
 public static void main(String[] args) {
   Retangulo meuRetangulo = new Retangulo();
   try {
     meuRetangulo.setAltura(-1);
     meuRetangulo.setLargura(50);
     System.out.println("A area do meu retângulo é = " + meuRetangulo.area());
   } catch (Exception ex) {
     System.out.println("Erro ao criar o retângulo:" + ex.getMessage());
   }
 }
示例#4
0
文件: Juncao.java 项目: cezaraf/jeppd
 @Override
 public boolean equals(Object obj) {
   if (this == obj) return true;
   if (obj == null) return false;
   if (getClass() != obj.getClass()) return false;
   Juncao other = (Juncao) obj;
   if (retanguloA == null) {
     if (other.retanguloA != null) return false;
   } else if (!retanguloA.equals(other.retanguloA)) return false;
   if (retanguloB == null) {
     if (other.retanguloB != null) return false;
   } else if (!retanguloB.equals(other.retanguloB)) return false;
   return true;
 }
示例#5
0
 public boolean contem(Rectangle r) {
   return corpo.contem(r);
 }
示例#6
0
 public boolean intersecciona(Rectangle r) {
   return corpo.intersecciona(r);
 }