Math

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mixmaster
    New Member
    • Nov 2006
    • 5

    Math

    Hi All
    very new to programing so please excuse me

    how would you create a math game in JAVA

    say 5 questions

    Thanks
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    Originally posted by mixmaster
    Hi All
    very new to programing so please excuse me

    how would you create a math game in JAVA

    say 5 questions

    Thanks
    What type of game are you wanting to make? Counting, guessing, etc...? Need more info to help.

    Comment

    • mixmaster
      New Member
      • Nov 2006
      • 5

      #3
      Hi Sorry

      One which asks pre set questions the user then inputs what they think is the answer and the computer ten provides a
      right or wrong answer

      Comment

      • sicarie
        Recognized Expert Specialist
        • Nov 2006
        • 4677

        #4
        Originally posted by mixmaster
        Hi Sorry

        One which asks pre set questions the user then inputs what they think is the answer and the computer ten provides a
        right or wrong answer
        What is your level of programming skill? I mean, quickly, I would just say:

        Output a question,
        read in the answer
        check the answer

        and repeat five times.

        This can differ in complexity as much as you want it to - from selecting questions randomly from a file or database so there is less repetition and comparing against strings of answers and keywords - to asking the same five questions, looking for numerical input for the easiest checking.

        It sounds like you need to create a better concept of how you want this game to be played (and then fit that to whatever timeline you need the program done by).

        Comment

        • mixmaster
          New Member
          • Nov 2006
          • 5

          #5
          Output a question,
          read in the answer
          check the answer

          Exactly that,

          My level of programing Lower than novice im afraid, Just started but having a bad time with it

          Thanks

          Comment

          • sicarie
            Recognized Expert Specialist
            • Nov 2006
            • 4677

            #6
            Originally posted by mixmaster
            Output a question,
            read in the answer
            check the answer

            Exactly that,

            My level of programing Lower than novice im afraid, Just started but having a bad time with it

            Thanks
            cout your question
            cin your answer
            check the answer (if statement)
            repeat 5 times

            If you're not sure what cout and cin means, check out thescripts' C++ tutorial:

            Comment

            • r035198x
              MVP
              • Sep 2006
              • 13225

              #7
              Originally posted by sicarie
              cout your question
              cin your answer
              check the answer (if statement)
              repeat 5 times

              If you're not sure what cout and cin means, check out thescripts' C++ tutorial:

              http://www.thescripts.com/serverside...ops/index.html
              I thought this was a java question. An interesting question I'd have to say.

              Comment

              • sicarie
                Recognized Expert Specialist
                • Nov 2006
                • 4677

                #8
                Originally posted by r035198x
                I thought this was a java question. An interesting question I'd have to say.
                That would present a slight problem, wouldn't it? Sorry, forgot which forum I was in :( .

                Here's Sun's Java tutorial....

                java programming, learn java, java examples, java sample code, getting started with java

                Comment

                • r035198x
                  MVP
                  • Sep 2006
                  • 13225

                  #9
                  Originally posted by mixmaster
                  Output a question,
                  read in the answer
                  check the answer

                  Exactly that,

                  My level of programing Lower than novice im afraid, Just started but having a bad time with it

                  Thanks
                  If you are a novice, then use a switch together with Math.random().
                  Here is the framework
                  Code:
                   while(user still wants to answer) { 
                   
                  		 int choice = (int)(Math.random()*5);[indent]switch(chioce) {
                     case 1: {
                  	  logic of question 1
                  	 ask if user still wants to answer
                     }
                     case n: {
                  	  logic of question n
                  	 ask if user still wants to answer
                     }
                  }
                  [/indent]}
                  Should be interesting to try out this first before you try to mess it up a little.

                  Comment

                  Working...