csakesz55

OOP_2013.02.13_tomb

Feb 13th, 2013
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.32 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package tomb;
  6.  
  7. import java.util.Scanner;
  8.  
  9. public class Tomb {
  10.  
  11.     public static void kiir(int[] k) {
  12.         for (int n : k) {
  13.             System.out.print(n + ", ");
  14.         }
  15.     }
  16.  
  17.     public static int[] csere(int max, int min) {
  18.         int[] cserelo = new int[2];
  19.         if (max < min) {
  20.             int temp = min;
  21.             min = max;
  22.             max = temp;
  23.         }
  24.         cserelo[0] = max;
  25.         cserelo[1] = min;
  26.         return cserelo;
  27.     }
  28.  
  29.     public static int[] general(int x, int y) {
  30.         int[] t = new int[100];
  31.         for(int i=0; i<t.length; i++){
  32.             t[i]=(int)(Math.random() * (x-y+1) + y);
  33.         }
  34.         return t;
  35.    
  36.     }
  37.  
  38.     public static void main(String[] args) {
  39.         System.out.println("Kerem a max erteket!");
  40.         Scanner read1 = new Scanner(System.in);
  41.         int x = read1.nextInt();
  42.        
  43.         System.out.println("Kerem a min erteket!");
  44.         Scanner read2 = new Scanner(System.in);
  45.         int y = read2.nextInt();
  46.        
  47. //        int[] cserelt = csere(x,y);
  48. //        int[] szamok = general(cserelt[0], cserelt[1]);
  49. //        kiir(szamok);
  50.        
  51.         kiir(general(csere(x,y)[0], csere(x,y)[1]));
  52.    
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment