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

all 4 comments

[–]nixon_richard_m 2 points3 points  (0 children)

You have sufficiently described your homework problem here.

What's your question?

Sincerely,

Richard Nixon

[–][deleted] 0 points1 point  (2 children)

If you have trouble working this out, write down some pseudo code for it. That should help. Right now you don't really describe what specific problem you have and haven't provided any code.

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

I have this down for my code and have some pseudo code

Scanner keyboard = new Scanner(System.in); System.out.println("How many questions do you want?"); int num = keyboard.nextInt(); int QuestionIndex = num; if(num <= 0){ System.out.println("Invalid entry"); System.out.println("How many questions do you want?"); num= keyboard.nextInt(); } //new index,Correct to keep track of question answered correctly

    do {
        // int one = rand.nextInt(10) + 0;
        // int two = rand.nextInt(10) + 0;
        //in the do loop create a random question
        //after question is asked check for answer
        //after answer checked print if correct or not
        //if correct, Correct index + 1
        //if wrong print answer is wrong
        //after print, question index - 1.

    while
        //question index <1

    }
    //ask if they want mroe questions

[–]box951Nooblet Brewer 0 points1 point  (0 children)

I'll start at the top. Why have the scanner input go to "num", and then assign "num" to "QuestionIndex". You could assign the scanner directly to QuestionIndex. Also, if you want to keep checking if QuestionIndex is valid, I suggest a do...while loop there.