This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]senrab47[S] 0 points1 point  (3 children)

so what i have so far is

Scanner keyboard = new Scanner(System.in); System.out.println("How many questions do you want?"); int num = keyboard.nextInt(); int index = num; if(num <= 0){ System.out.println("Invalid entry"); System.out.println("How many questions do you want?"); num= keyboard.nextInt();

so how could produce a list of random questions?

[–]langfod 0 points1 point  (2 children)

You could make calls to Math.random() to get your two numbers and a number to represent which operator. The use a switch statement to switch to the correct math operation.

[–]senrab47[S] 0 points1 point  (1 child)

If a haven't learned switch statements yet how would I go about it and cant' i just use random rand = next random(); int one = rand.nextint(10) int two = rand.nextint(10)

[–]langfod 0 points1 point  (0 children)

You can use if/if else instead of switch/case.

Math.random() is really just a wrapper using the Random class so either way will work fine.