Results 1 to 2 of 2
  1. #1
    Eilime is offline Member
    Join Date
    Apr 2011
    Posts
    1
    Rep Power
    0

    Post Compare true Answer /Player answer

    Hello
    It is a game with a part multiple-choice questionnaire and a part open.
    For the part of open questions, we ask mathematical questions and the player has to answer by a number (in Jtextfield: rep = new JTextField ())
    The questions / answers are in questions.java, I made like that:
    Java Code:
    Tab_ques [0] = " how much make 3+4? ";
    Tab_rep [0] = "7";
    
    Tab_ques [1] = " Complete the continuation : 0, 2,4,6, ";
    Tab_rep [1] = "8";
    And so on...

    But for the part opened question, I don't know which codes to use and how to compare true answers with the player answers .
    Last edited by Eilime; 04-24-2011 at 09:19 PM.

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

    Default

    Does your code even compile?

    Java Code:
    Final JButton confirm=new JButton ("Confirm");  // variable declared as [color="red"][b]c[/b][/color]onfirm
    // THE ACTIONS(SHARES) TO CONFIRM
    Confirm.addActionListener (new ActionListener () { // variable used as [color="red"][b]C[/b][/color]onfirm

    Also, when posting code here, please use code tags so that your code will retain its formatting and thus will be readable -- after all, your goal is to get as many people to read your post and understand your code as possible, right?

    To do this, highlight your pasted code (please be sure that it is already formatted when you paste it into the forum; the code tags don't magically format unformatted code) and then press the code button, and your code will have tags.

    Another way to do this is to manually place the tags into your code by placing the tag [code] above your pasted code and the tag [/code] below your pasted code like so:

    Java Code:
    [code]
      // your code goes here
      // notice how the top and bottom tags are different
    [/code]

Similar Threads

  1. Replies: 2
    Last Post: 03-07-2011, 08:39 PM
  2. Should be simple answer...
    By sleepingpeace in forum New To Java
    Replies: 4
    Last Post: 02-17-2011, 01:01 PM
  3. Could anyway answer me this?
    By Jojomofoman in forum New To Java
    Replies: 14
    Last Post: 12-16-2010, 11:14 PM
  4. Why is the answer not coming out
    By anonymous18 in forum New To Java
    Replies: 4
    Last Post: 11-12-2008, 03:10 AM
  5. Replies: 3
    Last Post: 11-02-2008, 01:29 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
  •