hi guys

remember that I had a game to build and was asking for help, well I spoke with my lecture and the game what I was talking about is more or less a program. it is a Java multiplication table math game but I have to build it like a program.. the game goes like this:
it has 5 levels. and each levels is made up of 3 and 4 rounds. level 1 which is level-easy is made up of 3 rounds, level - medium and hard is made up of 4 rounds. all in all each difficulty level consist of 12 questions.

now for level easy, every time the game is launch it must generate different random questions for each rounds - How do I do that: how do I generate random question every time the game is launch.

for level medium it has 4 rounds and it also must generate different random questions - again how do i do that. can any one guide me.

for level - hard, it must also generate different random question and again how do i do that.

in the starting up of the game, it must prompt for the student name and age, (which I already know this much) and it must also prompt for the difficulty level the student want to play - how do i do that. it should have these letters either "M" or 'm", "E' or "e' or "H" or "h' for either level they would imply.

functionality which should achieved is
in level one, it should have a welcome message and a comprehensive explanation and rules of the game (which I did), the student name and age and the level they want to purse (how do i prompt for the difficulty for the student to pursue)
level 2 the difficulty level should have specified the number of rounds with 12 questions and the game must always display the student current question number, game round and point/score and the number that they have remaining- how do I do that

level 3 each game round must generate random question every time the game is launched and they cannot proceed until to the next question until the student answer correctly the current question.

level 4 the game award point foe each correct question answered and they have four tries and chances decrease for every incorrect answer - the game must generate different randm question for each time it is launch (how do i do that)

level 5 the game sould only end when the students wins the game by answering the 12 question successfully or when they fail all chances.

I have to used the count and sum
how and when do I use the count and sum in the game.

Scanner scan = new Scanner (System.in);

        String students_name, welcome_msg, descrip_of_game,rules_ofgame, difficulty_level, state;
        int students_age, game_rounds;


        System.out.println("Welcome Students!!!\n" + "Come let’s have some fun with maths and give your brains a workout!!!\n" + "This is an interactive game which is design for students from second year to standard five. The game will give the student the basic knowledge of the multiplication tables and provide them with a solid foundation for future development.");
        welcome_msg = scan.nextLine();

        System.out.println("This game is made up to four levels. Each level is made up of a number of rounds. Level easy is made up of three rounds, while level medium and hard are made up of four rounds each. In each rounds and in each level, every correct answer your points will increase but will decrease with any incorrect answers. Each levels consist of 12 questions which must be answered correctly in order to advance. Each students are given a maximum of three chances.");
        rules_ofgame = scan.nextLine();

        System.out.println("please enter student name");
        students_name = scan.nextLine();

        System.out.println("please enter students age ");
        students_age = scan.nextInt();

Before you dive into your programming, you need to dissect your program.

1) How do you create a question? I would suggest that you have variables handling 3 separate values - two are for numbers to be multiplied and one answer. Because you separate values, you can use a simple random() method of Math class to generate random questions. You should be able to give a range of what random number you want. Because the method returns a decimal between 0 to 1, you must do something with it in order to get a number (i.e. multiply the returned value and use floor() or ceil() method to get a number).

2) You need to keep the score of how many questions the student answer correctly. You would have another variable to keep counting when the answer is right.

3) You could control the difficulty by increasing the multiplied number of each level. For example, in easy level, your random range could be from 0 up to 10. In medium level, your range could be from 9 up to 25. And in hard level, your range could be 15 up to 100.

Once you understand what exactly you are going to do, it is now about programming in steps.

1)Ask for user information when start the game.
2)Ask for difficult (or start from the first difficulty).
3)Start the game by generate a question regarding the selected difficulty. Wait for user input (must Enter). Verify that the input is a number. If it is not a number, reiterate the question again. If it is a number, check if it is correct. If it is correct, increase the correct answer count; otherwise, ignore.
4)Keep generating questions until it reaches the maximum question number of the level or whatever you want to end. Display the result.

You could use Scanner class to accept user input from monitor. You could do it 2 ways, accept as nextInt() or nextLine(). I prefer nextLine() because I can manipulate the input which comes in as a String. Using nextInt(), you need to handle Exception thrown. Also, you need to handle multiple input when a user enter multiple number with white spaces in between.

Is it possible to see the rest of the program it is quite interesting

hi scorpianman
here is the codes for the java multiplication game. it will look like a not too well written but I have try my best. still trying to figure dis shit out.

Scanner read =  new Scanner (System.in);
        Random rand = new Random();

          String welcome_msg, game_rules, student_name, play, report;

         int i = 0,   x = 0, age, questionnum;
         int chance = 0, points = 0, score =0;
         int check = 0;
         char diff = ' ',choice ='y';
         int numoftries = 0;


         System.out.println("Welcome Students!!!\n" + "To maths 1, 2, 3!!! Come let’s have some fun with maths and give your brains a workout!!!\n" + "This is an interactive, inexpensive, effective and educational game that is specifically design for primrary school students\n " + "The game will give the student the basic knowledge of the multiplication times math tables and provide them with a solid foundation for future development");
         welcome_msg = read.nextLine();

         System.out.println("This game is made up to six levels. Each level is made up of a number of rounds\n"  + "Level easy is made up of three rounds, while level medium and hard are made up of four rounds each\n" + "In each rounds and in each level, every correct answer your points will increase but will decrease with any incorrect answers\n" + "Each levels consist of 12 questions which must be answered correctly in order to advance\n" + "Each students are given a maximum of three chances\n"+ "Level 5 states that the students only win the game by answering all 12 questions correctly but fails if the students runs out of changes or tries\n" + "Level six states that each students should win the game if the student that chose either easy, medium or hard that they should be presented with the option to proceed to the next advanced level");
         game_rules = read.nextLine();


         while(choice =='y')
         {  
             System.out.println("please enter the students name");
             student_name = read.next();

             System.out.println("please enter the student age");
             age = read.nextInt();


             System.out.println("select difficulty");
             diff = read.next().charAt(0);

            if(diff == 'e' || diff== 'E') {
            if(chance!=4){
              System.out.println("round 1");
            for(i=0; i<5; i++)

            {
                System.out.println("rand.nextInt(12) + 1");
            if(x == 1){
            check = 0;
            if(chance ==4){
             break;
            }

            while(check == 0) {

                System.out.println("round 1, score " + score + "points\nquestion " + i + "what is 2 x 4");
            int ans = read.nextInt();

            if(ans == (2 * 4)){
            points = +1;
            check = 1;
             }

            else{
                System.out.println("incorrect answer " + "please try again");
            if(chance == 4){
             break;}

             chance =+1;

             }
            while(check == 0) {
                System.out.println("round 1, score " + score + "points\nquestion " + i + "what is 2 x 5");
            ans = read.nextInt();

            if(ans == (2 * 5)){
            points = +1;
            check = 1;
             }
            else{
              System.out.println("incorrect answer " + "please try again");
            if(chance == 4){
             break;}

             chance =+2;
            }

            while(check == 0) {
                System.out.println("round 1, score " + score + "points\nquestion " + i + "what is 2 x 6");
            ans = read.nextInt();

            if(ans == (2 * 6)){
            points = +1;
            check = 1;
             }
            else{
              System.out.println("incorrect answer " + "please try again");
            if(chance == 4){
             break;}

             chance =+3;
            }
            while(check == 0) {
                System.out.println("round 1, score " + score + "points\nquestion " + i + "what is 2 x 7");
            ans = read.nextInt();

            if(ans == (2 * 7)){
            points = +1;
            check = 1;
             }

            else{
              System.out.println("incorrect answer " + "please try again");
            if(chance == 4){
             break;}

             chance =+4;
            }
            if(numoftries == 0){

            }

            if(chance !=4){
            System.out.println("round 2");
            for(i=0; i<5; i++)
            {
             x = (int)(Math.random()*8)+1;
            if(x == 1){
            check = 0;
             if(chance ==4){
             break;}
            }
            while(check == 0) {
            System.out.println("round 2, score " + score + "points\n question " + i + "what is 3 x 6");
             ans = read.nextInt();

            if(ans == (2 * 3)){
             points = +1;
             check = 1;
            }
            else{
            System.out.println("incorrect answer " + "please try again");
            if(chance == 4){
            break;}

            chance =+1;  
            }


            if(chance !=4){
              System.out.println("round 3");
            for(i=0; i<5; i++)

            {
             x = (int)(Math.random ()* 8)+1;
             if(x == 1){
             check = 0;
             if(chance == 4){
             break;}

            if(check == 0){
            if(chance == 4){
            break;}
            }
             while (check == 0){

              System.out.println("round 1, score " + score + "point\nquestion " + i + " what is 4 x 4");
              ans = read.nextInt();

            if(ans == (4 * 4)){
             points = +1;
             check = 1;
            }
            else{

                System.out.println("incorrect answer " + "please try again");

            if(chance == 4){
            break;}

            chance =+1;   
            }
             if(diff == 'm'){

             if(chance !=4){

               System.out.println("round 1");

                for(i = 0; i<5; i++){
                     x = (int)(Math.random()*8)+1;
            if(x == 1){
            check = 0;
            if(chance ==4){
             break;
            }

            while(check == 0) {

              System.out.println("round 1, score " + score + "points\nquestion " + i + "what is 5 x 2");
              ans = read.nextInt();

            if(ans == (2 * 4)){
            points = +1;
            check = 1;
             }

            else{
                System.out.println("incorrect answer " + "please try again");
            if(chance == 4){
             break;}

             chance =+3;

            }

            if(diff == 'h'){
                if(chance!=4){
                    System.out.println("round 1");
                for(i = 0; i<5; i++){
                     x = (int)(Math.random()*8)+1;
            if(x == 1){
            check = 0;
            if(chance ==4){
             break;
            }

            while(check == 0) {

                System.out.println("round 1, score " + score + "points\nquestion " + i + "what is 1 x 9");
                ans = read.nextInt();

            if(ans == (1 * 9)){
            points = +1;
            check = 1;
             }

            else{
                System.out.println("incorrect answer " + "please try again");
            if(chance == 4){
             break;}

             chance =+1;

             }


            System.out.println("do you want to play again");
            choice = read.next().charAt(0);
        }
     }      
}
commented: Hi divinity02,thanks for the added info.I myself am trying to get the the program to run, still needs to sort out some syntex errors,hoping it works out.If you got any new ideas will like to see it.Really need to make it work. +0

If you could come up with a flow chart, it would help your implementation ;)

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.