HayCZ

ipalp_matice_FEI_deklar2

Apr 23rd, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.99 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package izapr_cv07;
  7.  
  8. import java.util.Locale;
  9.  
  10. /**
  11.  *
  12.  * @author st55431
  13.  */
  14. public class Izapr_cv07 {
  15.  
  16.     /**
  17.      * @param args the command line arguments
  18.      */
  19.     public static void main(String[] args) {
  20.        Matice m = null;
  21.         Matice m2;
  22.         int a = 5;
  23.         int b = 5;
  24.         m = new Matice(a, b);
  25.         m2 = new Matice();
  26.         m.napln(1, 2);
  27.         System.out.println(m.toString("%4.1f "));
  28.  
  29.         System.out.println("");
  30.         System.out.println(m.toString());
  31.        
  32.          System.out.println("");
  33.         System.out.println(m2.toString());
  34.        
  35.         System.out.println("Diagonála");
  36.         double[] diagonala = m.diagonala();
  37.         for (int i = 0; i < diagonala.length; i++) {
  38.         System.out.printf(Locale.ENGLISH, "%4.1f ", diagonala[i]);
  39.         }
  40.         System.out.println("\nNad hlavní");
  41.         Matice mt = m.horniNadHlavniDiagonalou();
  42.         System.out.println("\n" + mt.toString("%4.1f "));
  43.         System.out.println("Pod hlavní");
  44.         Matice mp = m.dolniPodHlavniDiagonalou();
  45.         System.out.println("\n" + mp.toString("%4.1f "));
  46.        
  47.         System.out.println("Vedlejší diagonála"); //Nejde
  48.         double[] vedlejsiDiagonala = m.vedlejsiDiagonala();
  49.         for (int i = 0; i < vedlejsiDiagonala.length; i++) {
  50.         System.out.printf(Locale.ENGLISH, "%4.1f ", vedlejsiDiagonala[i]);
  51.         }
  52.         System.out.println("\nNad vedlejsi"); //Nejde
  53.         Matice ms = m.horniNadVedlejsiDiagonalou();
  54.         System.out.println("\n" + mt.toString("%4.1f "));
  55.         System.out.println("Pod vedlejsi"); //Nejde
  56.         Matice mr = m.dolniPodVedlejsiDiagonalou();
  57.         System.out.println("\n" + mp.toString("%4.1f "));
  58.        
  59.        
  60.        
  61.         //Najdi MAX a MIN Prvek.
  62.     }
  63.    
  64. }
Add Comment
Please, Sign In to add comment