MatComplejo.java_



class MatComplejo
{
	public static void main(String X[])
	{
		int OR = Integer.parseInt(Lee.LeeDato("Orden de la matriz:"));
		Complejo A[][] = new Complejo[OR][OR];
		Complejo B[][] = new Complejo[OR][OR];
		Complejo R[][] = new Complejo[OR][OR];

		System.out.println("Matriz A");
		A = PideDatos(A);
		System.out.println("Matriz B");
		B = PideDatos(B);
		R = Suma(A, B);
		Imprime(R);
	}


	static Complejo[][] PideDatos(Complejo A[][])
	{
		for (int r = 0; r < A.length; r++)
			for (int c = 0; c < A[0].length; c++)
			{
				A[r][c] = new Complejo(0,0);
				A[r][c].Real = Integer.parseInt(Lee.LeeDato("Parte real"));
				A[r][c].Imag = Integer.parseInt(Lee.LeeDato("Parte imag"));
			}
		return A;
	}

	static Complejo[][] Suma(Complejo A[][], Complejo B[][])
	{
		for (int r = 0; r < A.length; r++)
                   for (int c = 0; c < A[0].length; c++)
			A[r][c].Suma(B[r][c]);
		return A;
	}

	static void Imprime(Complejo R[][])
	{
		for (int r = 0; r < R.length; r++)
               		for (int c = 0; c < R[0].length; c++)
		     		R[r][c].Imprime();
	}
}