for (count=1; count<=10; count++)    
        {
            number1= randomNumber.nextInt(10)+1;
            number2= randomNumber.nextInt(10)+1;
            Help correct= new Help(number1, number2); 

            switch(choice)


                                    case 2:
                    if (number1 > number2)
                    {

                        System.out.print("What is the answer to this problem? " +
                                      number1 + "-" + number2 + ":");
                        ans= keyboard.nextInt();//stops at 2 problems!!!!!!

                    a= correct.getSub();

                    if(ans == a)
                    { 

                        System.out.println("The answer is CORRECT!!!!!");
                        System.out.println();
                        rigth +=1;
                    }
                    else
                    {
                        System.out.println("The answer is INCORRECT!!!");
                       System.out.println("The correct answer is: " +a);
                       System.out.println();
                    }
                    }

hey

what is randomNmber in ur code?

post full code instead of a part..

Obviously this is meant to generate arithmetic problems, so the random is fine. This gives you randomly generated subtraction problems.

Why it stops is not obvious from this code. Potential problem spots would include the switch value - what is "choice" and does it change in the loop? If it does, what are the other cases of the switch? If if doesn't change, why check against it repeatedly? The continuation of the if statement bothers me as well - what happens if number2>number1 or number2==number1? Also, just for giggles, let's just make sure you have your break statements in each case of the switch. Always worth checking for that.

Whether it's one of these or something else, I can't say without seeing more code. Any further code ought to be posted in code tags. Select your code and click on the (code) button above the text entry box.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.