Advertisement
KeeJayBe

euromillions prog1

Jan 16th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.80 KB | None | 0 0
  1. /*
  2.  * KK    KK  JJJJJJJJJJ  BBBBBBBB
  3.  * KK  KK            JJ  BB      BB
  4.  * KKKK              JJ  BBBBBBBB
  5.  * KK  KK    JJ      JJ  BB      BB
  6.  * KK    KK    JJJJJJ    BBBBBBBBBB
  7.  *
  8.  * Copyright 2018 Jordy Van Kerkvoorde
  9.  */
  10. package domein;
  11.  
  12. import java.security.SecureRandom;
  13. import java.util.Arrays;
  14.  
  15. /**
  16.  *
  17.  * @author KeeJayBe
  18.  */
  19. public class EuroMillionsApplicatie {
  20.         public static void main(String[] args) {
  21.         int[] cijfers = new int[5];
  22.         int[] sterren = new int[2];
  23.         String[] sterrenbeeld={
  24.         "Ram", "Leeuw", "Boogschutter", "Stier",
  25.         "Maagd", "Steenbok", "Tweelingen", "Weegschaal",
  26.         "Waterman", "Kreeft", "Schorpioen", "Vissen"
  27.         };
  28.         SecureRandom random = new SecureRandom();
  29.        
  30.         cijfers[0]= random.nextInt(51)+1;
  31.         int i = 1;
  32.         while(i<=4){
  33.             cijfers[i]=random.nextInt(51)+1;
  34.             boolean check = true;
  35.             for(int j=0; j<i;j++){
  36.                 if(cijfers[j]==cijfers[i]){
  37.                     check = false;
  38.                 }
  39.             }
  40.             if(check==true){
  41.                 i++;
  42.             }
  43.         }
  44.         Arrays.sort(cijfers);
  45.         System.out.println("De cijfers zijn " + Arrays.toString(cijfers));
  46.        
  47.         sterren[0]= random.nextInt(11)+1;
  48.         sterren[1]= random.nextInt(11)+1;
  49.         boolean sterCheck = false;
  50.         while(!sterCheck){
  51.         if(sterren[0]==sterren[1]){
  52.             sterren[1]= random.nextInt(11)+1;
  53.         }else{
  54.            sterCheck = true;
  55.         }
  56.         }
  57.         Arrays.sort(sterren);
  58.         System.out.println("De cijfers zijn " + Arrays.toString(sterren));
  59.        
  60.         int rand = random.nextInt(11) + 1;
  61.         System.out.println("Het sterrenbeeld = " + sterrenbeeld[rand]);
  62.     }
  63.    
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement