Results 1 to 12 of 12
  1. #1
    holy crab is offline Member
    Join Date
    Apr 2010
    Posts
    7
    Rep Power
    0

    Default I need this game!!!

    I have to complete this projec in 2 days please help me!===


    Problem Description:
    Write a game to help users to improve their arithmetic calculation skills. The aim of the game is to solve maximum number of questions correctly in a limited time. The game must generate random arithmetic expressions of two and three operations with random integer operands and asks the user the answer. If the user correctly writes the answer, the program generates the next random question until the time finishes. Use the following rules to implement your program.

    1. Give initial time of 1 minute (increase the total time by 5 seconds if 5 questions in a row were correct).
    2. Implement two levels:
    a) First level uses one operation with two operands only, e.g. 5+3 ?
    b) Second level uses two operations with three operands , e.g. 20 / 4 + 5 ?
    3. At the end of the program calculate and show the score by grading total number of correctly answered questions. The program also must display the total time that is elapsed and number of correct answer/questions. You can provide motivational messages such as in the sample run that is provided.
    4. According to the score of the user, put a threshold to decide whether the user can advance to the next level or repeat the current level.
    5. At the end of game ask the user if he wants to repeat the level, advance to the next level (if he has enough points), or quit the program.
    Here is a sample run of the program:

  2. #2
    holy crab is offline Member
    Join Date
    Apr 2010
    Posts
    7
    Rep Power
    0

    Default

    IT MUST LOOK LIKE ;


    Welcome to Arithmetic’s Exercise Program
    Answer as many questions in total 60 seconds.
    You get 5 seconds bonus if you answer 5 questions in a row.
    Use java arithmetic precedence rules!
    Input ‘q’ to quit or any key to start:

    1. 5+6*9 = 59 … Correct
    2. 2-6*0 = 2 … Correct
    3. 3/8+5 = 5 … Correct
    4. 8/2-4 = 0 … Correct
    5. 9*12+0 = 96 … Correct (5 seconds added)
    6. 52-12+13 = 51 … Wrong
    7. 5+1*9 = 59 … wrong
    8. 2-2*0 = 2 … wrong
    9. 3/1+5 = 5 … wrong
    Time finished!

    You are as fast as a turtle!
    You answered 5 questions correctly out of 9 in 65 seconds.

    You can not advance to the next level
    Input ‘q’ to quit or any key to restart:

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    You have essentially posted your assignment and shown no work, shown no effort as if you want someone here to do this for you. Well, it ain't going to happen. By posting this way, you are risking cheating yourself out of the education you gain by doing this yourself and learning as you are doing, and none of us wish to deprive you of this benefit. We will be happy to answer specific questions you may have regarding problems with your code, but first you need to show some initiative and effort.

    Best of luck.
    Last edited by Fubarable; 04-10-2010 at 01:55 PM.

  4. #4
    holy crab is offline Member
    Join Date
    Apr 2010
    Posts
    7
    Rep Power
    0

    Default

    Of course I do not want someone to do this assigment for me! I just need some trick if anyone knows! thats all I want! this is a kind of hard job, so nobody wants to do it!

  5. #5
    holy crab is offline Member
    Join Date
    Apr 2010
    Posts
    7
    Rep Power
    0

    Default

    import java.util.Scanner;
    public class TheGame {
    public static void main (String [] args){
    int count= 0;
    while (count<100){
    int number1 = (int)(Math.random()* 10);
    int number2 = (int)(Math.random()* 10);
    Scanner input = new Scanner(System.in);
    System.out.print("What is " + number1 + " + " + number2 + "?");
    int answer = input.nextInt();
    System.out.println(number1+ " + " + number2 + " = " + answer + " is " + (number1+number2 == answer));
    count++;
    long endTime = System.currentTimeMillis();
    long testTime= endTime - startTime;
    System.out.println ("Correct count is " + correctCount + "\nTest time is " + testTime /1000 + "seconds\n" + output);
    }
    }
    }

    and I did some codes like that but it does not work. I could not manage the time code:S

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by holy crab View Post
    Of course I do not want someone to do this assigment for me! I just need some trick if anyone knows! thats all I want! this is a kind of hard job, so nobody wants to do it!
    Please look at the last link in my signature for useful tricks. Also the other links including the second one can help you get more helpful answers here. Best of luck.

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Have you worked with creating methods other than the main, because you're going to have to do this to solve this assignment. Your best bet is to break the problem down into steps and try to solve each step in isolation.

    for e.g.,
    Pseudo-code
    Java Code:
    begin
      start count-down timer
      while time remaining > 0
        show level-1 question
        get answer, check answer, update score
        if correct: increase fiveInRowCorrect int by 1, else fiveInRowCorrect = 0
        if fiveInRowCorrect >= 5, then time remaining += 5 seconds and fiveInRowCorrect = 0
      end while
    end

  8. #8
    holy crab is offline Member
    Join Date
    Apr 2010
    Posts
    7
    Rep Power
    0

    Default

    thanks for ur help, I have last question now; how can I divide the game two different levels

  9. #9
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Location
    Zurich, Switzerland
    Posts
    962
    Rep Power
    6

    Default

    Quote Originally Posted by holy crab View Post
    thanks for ur help, I have last question now; how can I divide the game two different levels

    i would write a method that returns questions with two operands for the easy part and the same method that returns questions with three operands, depending what level is selected. all the other code for the game is the same.

    this game is almost the same game in dr. kawashima's brain training for nindendo ds. are here any awt/swing programmers that are interested in writing some parts of Dr Kawashima's Brain Training: How Old Is Your Brain?

  10. #10
    holy crab is offline Member
    Join Date
    Apr 2010
    Posts
    7
    Rep Power
    0

    Default

    Thank you for ur help, I will try to do it, then will show u again..

  11. #11
    holy crab is offline Member
    Join Date
    Apr 2010
    Posts
    7
    Rep Power
    0

    Default

    import java.util.Scanner;
    public class TheGame {

    public static void main (String [] args){
    final int Number_of_Questions=9;
    int trueCount=0;
    int count=0;
    long startTime=System.currentTimeMillis();
    while (count<10){
    int number1 = (int)(Math.random()* 10);
    int number2 = (int)(Math.random()* 10);
    Scanner input = new Scanner(System.in);
    System.out.print("What is " + number1 + " + " + number2 + "?");
    int answer = input.nextInt();
    if (answer == (number1+number2))
    trueCount++;

    System.out.println(number1+ " + " + number2 + " = " + answer + " is " + (number1+number2 == answer));
    count++; }

    long endTime = System.currentTimeMillis();
    long testTime = endTime - startTime;

    System.out.println("You asnwered " + trueCount + " questions correctly " + "\n in " + testTime / 1000 + " seconds\n");

    }
    }


    The last view of my project is like that now! but I can not manage the time ; for example I have to give a limited time but how? and also how can I add extra 5 seconds for every 5 correct questionss??? :S:S

    thankss

  12. #12
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Lightbulb

    Quote Originally Posted by holy crab View Post

    The last view of my project is like that now! but I can not manage the time ; for example I have to give a limited time but how? and also how can I add extra 5 seconds for every 5 correct questionss??? :S:S

    thankss
    use java.util.TimerTask or java.util.Timer to solve it ;)
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

Similar Threads

  1. Replies: 2
    Last Post: 08-05-2010, 04:49 AM
  2. Help! Game.
    By MIA6 in forum New To Java
    Replies: 4
    Last Post: 11-08-2009, 12:22 AM
  3. Help with my game!
    By Manikyr in forum New To Java
    Replies: 6
    Last Post: 06-06-2009, 11:09 AM
  4. Game 21
    By aRTx in forum Advanced Java
    Replies: 3
    Last Post: 04-04-2009, 12:33 AM
  5. 2D strategy game or 2D war game
    By led1433 in forum Java 2D
    Replies: 5
    Last Post: 02-10-2009, 06:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •