Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1.  
  2. package onlineQuiz;
  3.  
  4. import java.util.Scanner;
  5. import java.util.Random;
  6.  
  7. public class OnlineQuiz {
  8.  
  9.     /**
  10.      * @param args
  11.      */
  12.     public static void main(String[] args) {
  13.         // declare variable
  14.         int totalScore = 0;
  15.         Scanner input = new Scanner(System.in);
  16.         Random rng = new Random();
  17.         QuestionBank qb = new QuestionBank;
  18.        
  19.         int questionsasked[] = new int[5];
  20.        
  21.         for (i=0;i<4;i++)
  22.         {
  23.             int nextnumber  = rng.nextInt(9);
  24.             boolean repeated = false;
  25.             for (j=0;i<4;i++)
  26.             {
  27.                 if(nextnumber == questionsasked[j])
  28.                     repeated = true;
  29.             }
  30.             if(!repeated)
  31.                 questionasked[i] = nextnumber;
  32.         }
  33.  
  34.     }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement