import java.lang.*; public class testVectorAyudante { public static void main(String[] args) { Vector v1 = new Vector( 10D, 20D); Vector v2 = new Vector( 15D, 15D); Vector vc1 = new Vector( 25D, 35D); System.out.println("TEST v1.sumarle(Vector v):\t COORDENADAS cartesianas"); System.out.println("v1 = " + v1.toString() + " v = " + v2.toString()); v1.sumarle(v2); System.out.println("Resultado: " + v1.toString()); if(v1.equals(vc1)) System.out.println("TEST PASSED\n"); else System.out.println("TEST FAILED\n"); Vector v3 = new Vector(10F, Math.PI/4 ); Vector vc2 = new Vector(40F, Math.PI/4); float m = 4; System.out.println("Test v1.multiplicacionPorEscalar(float m):\t COORDENADAS polares"); System.out.println("v1 = " + v3.toString() + " m = " + m); v3.multiplicacionPorEscalar(4); System.out.println("Resultado: " + v3.toString()); if(v3.equals(vc2)) System.out.println("TEST PASSED\n"); else System.out.println("TEST FAILED\n"); Vector v4 = new Vector(15F, (Math.PI)/2 ); Vector vc3 = new Vector(15F, Math.PI); float alfa = (float)(Math.PI)/2; System.out.println("Test rotar(float alfa):\t COORDENADAS polares"); System.out.println("v2 = " + v4.toString() + " alfa = " + alfa); v4.rotar(alfa); System.out.println("Resultado: " + v4.toString()); if(v4.equals(vc3)) System.out.println("\nTEST PASSED\n"); else System.out.println("\nTEST FAILED\n"); Vector v5 = new Vector( 25D, 40D); Vector v6 = new Vector( 10D, 45D); Vector vc4 = new Vector( 35D, 85D); System.out.println("Test suma(v5, v6):\t COORDENADAS cartesianas"); System.out.println("v5 = " + v5.toString() + " v6 = " + v6.toString()); Vector vt1 = Vector.suma(v5, v6); System.out.println("Resultado: " + vt1.toString()); if(vt1.equals(vc4)) System.out.println("TEST PASSED\n"); else System.out.println("TEST FAILED\n"); Vector v7 = new Vector( 40D, 30D); Vector v8 = new Vector( 10D, 20D); Vector vc5 = new Vector( 30D, 10D); System.out.println("Test resta(v7, v8):\t COORDENADAS cartesianas"); System.out.println("v7 = " + v7.toString() + " v8 = " + v8.toString()); Vector vt2 = Vector.resta(v7, v8); System.out.println("Resultado: " + vt2.toString()); if(vt2.equals(vc5)) System.out.println("TEST PASSED\n"); else System.out.println("TEST FAILED\n"); Vector v9 = new Vector( 10F, Math.PI/2); Vector v10 = new Vector( 30D, 40D); float ppc = 400; System.out.println("Test productoPunto(v9, v10):\t COORDENADAS mixtas"); System.out.println("v9 = " + v9.toString() + " v10 = " + v10.toString()); float pp = Vector.productoPunto(v9, v10); System.out.println("Resultado: " + pp); if(pp == ppc) System.out.println("TEST PASSED\n"); else System.out.println("TEST FAILED\n"); } }