Advertisement
alduncin

Montante.java

Feb 25th, 2012
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.33 KB | None | 0 0
  1. //montante.java  Karen Alduncin 1476867
  2.  
  3. package carpeta;
  4. import carpeta.Fracciones;
  5. import java.util.*;
  6.  
  7. public class Montante extends Fracciones
  8. {
  9.     public static void main (String args[])
  10.     {
  11.     int n,i,j,temp,iteracion=0;
  12.     //._. crear metodos fuera de este chingado metodo( ) ;  
  13. System.out.println("dame el tamaño de tu matriz : ");
  14.     Scanner lector = new Scanner(System.in);
  15.     n= lector.nextInt();
  16.     //madres .l.
  17.  
  18.     //construir :D MADRES ;@
  19.     Fracciones MatAnt = new MatAnt[n][2*n];
  20.     Fracciones MatAnt = new MatAct[n][2*n];
  21.     Fracciones MAtAnt = new otemp();
  22.     Fracciones MatAnt = new PivoteAnterior();
  23.     Fracciones MAtAnt = new PivoteActual();
  24.  
  25.  
  26.     for(i=0;i<n;j++)
  27.     {
  28.         for(j=0;j<n;j++)
  29.         {
  30.             System.out.println("valor de ["+i+"]["+j+"] :");
  31.             temp=lector.nextInt();
  32.             otemp=(Fracciones)temp;//.D
  33.             MatAnt[i][j+n]=otemp;
  34.             if(i==j)
  35.             {
  36.                 otemp= Fraccion(1);
  37.                 MatAnt[i][j+n]=otemp;
  38.                 }
  39.         }
  40.     }
  41.     PivoteAnt=Fraccion(1);
  42.     for(i=0;i<n;i++)
  43.     {
  44.         for(j=0;j<2*n;j++)
  45.         {
  46.             System.out.print(" ");
  47.             MatAnt[i][j].printf();
  48.         }
  49.         System.out.print("\n");
  50.     }
  51. do
  52.     {
  53.     PivoteActual=MatAnt[iteracion][iteracion];
  54.     for(j=0;j<n*2;j++)
  55.         {
  56.         MatAct[iteracion][j]=MatAnt[iteracion][j]/PivoteActual;
  57.         }
  58.     //._.
  59.     for(i=0;i<n;i++)
  60.         {
  61.         if(i!=iteracion)
  62.             {
  63.             otemp=Fraccion(0);
  64.             MatAnt[i][iteracion]=otemp;
  65.             }
  66.         }
  67.     for(i=0;i<n;i++)
  68.         {
  69.         for(j=0;j<2*n;j++)
  70.             {
  71.             if(i !=iteracion)
  72.                 {
  73.                 if(j!=iteracion)
  74.                     {
  75.         MatAct[i][j]=((PivoteActual*MatAnt[i][j])
  76.       -(MatAnt[i][iteracion]*MatAct[iteracion][j]/PivoteAnterior));//act
  77.                     }
  78.                 }
  79.             }
  80.         }
  81.     for(i=0;i<n;i++)
  82.         {
  83.         for(j=0;j<2*n;j++)
  84.             {
  85.             MatAnt[i][j]=MatAct[j][i]; //wait
  86.             }
  87.         }
  88.     PivoteAnterior=PivoteActual;
  89.     iteracion++;
  90.     //....
  91.     System.out.print("\n\n");
  92.     //c/u
  93.     for(i=0;i<n;i++)
  94.         {
  95.         for(j=0;j<2*n;j++)
  96.  
  97.             {
  98.             System.out.print("  ");
  99.             MatAnt[i][j].printf();
  100.             }
  101.         System.out.print("\n ");
  102.         }
  103.     System.out.print("\n");
  104.     }
  105. while(iteracion< n);
  106.     System.out.print("\n\n");
  107.     for(i=0;i<n;i++)
  108.     {
  109.         for(j=0;j<2*n;j++)
  110.         {
  111.             System.out.print(" ");
  112.             MatAnt[i][j].printf();
  113.         }
  114.         System.out.print("\n");
  115.     }
  116.     }
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement