Transcript
public class TestForma{,
,
public static void main(String[] args){,
Forma[]v = new Forma[6]; ,
,
v[0] = new Circulo(13.00);,
v[1] = new Quadrado(5.00);,
v[2] = new Triangulo(3.00, 5.00);
v[3] = new Esfera(9.00);,
v[4] = new Cubo(7.00);,
v[5] = new Tetraedro(14.00);,
,
for(Forma check : v){ ,
if(check instanceof FormaBidimensional){,
,
" System.out.printf(check.toString() + ""Area = %.2f\n\n, check.obterArea());
}
if(check instanceof FormaTridimensional ){
System.out.printf(check.toString() + ""Area = %.2f e ", check.obterArea());
,
FormaTridimensional x = (FormaTridimensional)check;,
,
" System.out.printf(""Volume = %.2f\n\n, x.obterVolume());
}
}
}
}",