hi
I am trying to build this game. what i have been trying to build for a long time now. it is a multiplication java game that need random numbers to generate
it goes like this
difficulty level-easy: this difficulty level easy has 3 rounds. the student must be tested on 4 random question from the 2 times table (round 1) 4 random question from the 3 times table (round 2) and 4 random question from the 4 times table(round3) every time the game is launched it must generate different random questons for each round.
here it what i have so far but it is not the correct because it is generation something different

        String welcomemsg;
        int count =0;
        int timestable, user1age, user2age;
        int chances=0; // depend on the number of chances given
        int corrans = 0; // to hold all of the correct answer
        int scores = 0; // to keep track of the scores made in the game
        int wrongans =0; // to hold the number of wrong answer entered
        int count_leveleasy = 0; // which level of the game the user choose to play
        int count_levelmedium =0; // which level of the game the user choose to play
        int count_levelhard = 0; // which level of the game the user choose to play
        int passmark = 50;
        int userans =0, correct = 0;
        int product =0, random1= 0, random2 = 0, problem =1;
        String choice;
        int b1value = 0,d1value = 0;
        int ans;



        // introduction and rules of the game to the players
        System.out.println("Hi everyone, welcome to Aunty Bae Multiplication quiz!!!!!!!");
        System.out.println("Here is where you learn your multiplication table");
        System.out.println("Rules of the games");
        System.out.println("Student should be between the ages of 6 to 12 years old");
        System.out.println("Each student are given three chances each");
        System.out.println("the game will be forfeited if the criteria doesnt met");


        System.out.println("***************************************************************");

        //a while loop prompting the user to enter which level they choose to play
        while(count_leveleasy == 'E' || count_leveleasy == 'e' || count_levelmedium == 'M' || count_levelmedium == 'm' || count_levelhard == 'H' || count_levelhard == 'h')
        {
          System.out.println("what level of the game would like to start with");//here it is aking the user to enter the level they want to play
        }
        //here it is aking for the user1 name and age
        System.out.println("Hi user1 can you tell me what is your name");
        String user1name = userinput.next();
        System.out.println("you have such a beautiful and unique name");
        System.out.println("Hi user1 can you tell me how old are you"  + "\t" + user1name);
        user1age = userinput.nextInt();

       //this while loop is for in case the user enter the wrong age
        while(user1age < 6 || user1age > 12)
        {
            if(user1age < 6 || user1age > 12)
        {
            System.out.println("boom bang!!!, no honey you cannot play this game " + user1name);
        }
           else
        {
            System.out.println("you have reach the age to play so come play " + user1name);
            break;
        }
         //asking for user2 name and age
        System.out.println("Hi user2 can you tell me what is your name");
        String user2name = userinput.next();
        System.out.println("how come you have such a unique name");
        System.out.println("Hi user2 can you tell me what is your age" +"\t" + user2name);
        user2age = userinput.nextInt();

        //this while is in case the user also enter the wrong age
        while(user2age > 6 || user2age > 12)
        {
          if(user2age < 6 || user2age >12)
        {
           System.out.println("no sweetheart you simply cannot play " + user2name);
        }
          else
        {
           System.out.println("okay honey you can play, let play " + user2name);
          break; 
        }
          //this while loop use for the both players enter the wrong age

          while(user1age < 6 || user1age > 12 && user2age > 6 || user2age > 12)
        {
            System.out.println("user1  what is your age again" + "\t" + user1name);
            user1age = userinput.nextInt();

            System.out.println("user2 now tell me, how old are you again" +"\t"+ user2name);
            user2age = userinput.nextInt();

            System.out.println("wow!!! nah man come on!! tell me that the both of you dont know the age requirement!!! you just can't play");

            System.out.println("please send in more players or can you both re-enter your age");
            break;
        }

          //this is asking both users to enter the correct age
          while (user1age > 6 || user1age <12 || user2age > 6 || user2age < 12)
        {
            System.out.println("user1 now correct me if I am wrong, tell me your age again" + "\t"+user1name);
            user1age = userinput.nextInt();

            System.out.println("user2 sigh, how old are you again" +"\t"+ user2name);
            user2age = userinput.nextInt();

            System.out.println("phew!!!! now we are getting somewhere!!!! let's see if we can get this thing going ");

            System.out.println("let me welcome the both of you to the game!!!!!!");
            break;
            }
            System.out.println(" welcome, user1 to " + "round 1" + "count_leveleasy " + user1name);

            Random randobj = new Random();
            int digit1 = randobj.nextInt(2);
            int digit2 = randobj.nextInt(2);



            for(int i = 0; i < 4; i++)
            {
                 ans = digit1 * digit2;
                System.out.println("how much is %d times?\n" + digit1 + digit2);



            }
            if(userans == (digit1 * digit2))
            {
                System.out.println("\ncorrect");
                corrans++;
                scores += 100;
            }
            else
            {
                System.out.println("\nincorrect, try again");
                wrongans++;
                scores = -25;
            }

            if (scores != passmark)
            {
                System.out.println("sorry honey, you cant move to the next leve; ");

            }
            else if(passmark == 50)
            {
                System.out.println("you can now move to the next level");
            }

        }
        }
        }
        here is the output
        run:
Hi everyone, welcome to Aunty Bae Multiplication quiz!!!!!!!
Here is where you learn your multiplication table
Rules of the games
Student should be between the ages of 6 to 12 years old
Each student are given three chances each
the game will be forfeited if the criteria doesnt met
***************************************************************
Hi user1 can you tell me what is your name
g
you have such a beautiful and unique name
Hi user1 can you tell me how old are you    g
4
boom bang!!!, no honey you cannot play this game g
Hi user2 can you tell me what is your name
f
how come you have such a unique name
Hi user2 can you tell me what is your age   f
13
no sweetheart you simply cannot play f
user1  what is your age again   g
4
user2 now tell me, how old are you again    f
14
wow!!! nah man come on!! tell me that the both of you dont know the age requirement!!! you just can't play
please send in more players or can you both re-enter your age
user1 now correct me if I am wrong, tell me your age again  g
11
user2 sigh, how old are you again   f
10
phew!!!! now we are getting somewhere!!!! let's see if we can get this thing going 
let me welcome the both of you to the game!!!!!!
 welcome, user1 to round 1count_leveleasy g
how much is %d times?
10
how much is %d times?
10
how much is %d times?
10
how much is %d times?
10

correct
sorry honey, you cant move to the next leve; 
okay honey you can play, let play f
BUILD SUCCESSFUL (total time: 22 seconds)

? That reads the wrong way round...
If you do not set a seed then the Random() constructor picks one - eg current time in mSec - so two runs will provide different sequences.
If you set a seed and it's the the same, then you will get the same sequence.

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.