Answer to Question #20144 in Java | JSP | JSF for semere meshesha

Question #20144
we have 100 questions and 60 students. write a java code that randomly selects 20 questions from 100 questions to 60 students.
1
Expert's answer
2012-12-11T08:34:21-0500

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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS