we have 100 questions and 60 students. write a java code that randomly selects 20 questions from 100 questions to 60 students.
import java.util.Random;
public class RandomQuestions {
public static void main(String args[]) {
& int n=1;
& Random r = new Random();
& while (n<61) {
System.out.print("Number of questions " + n + " is: ");
for (int i = 0; i < 20; i++) {
System.out.print((r.nextInt(100)+1)+" ");
}
System.out.println("");
n++;
& }
}
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
JavaJSPJSF