Count correct and incorrect answers

I have attached part of my code that is currently working.
The only thing I would like to change is I would like to add
another var counter which keeps track of wrong answer (wrong answer
being when a user does not drop the object on the correct
location). thanks for your time,

initialize an incorrectCounter next to your counter and
increment it in the else-branch of your onRelease
if-statement.

Similar Messages

  • Getting Correct and Incorrect to show on my GUI

    What am i missing to allow correct and incorrect to show on my GUI.
    package anaquiz;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class AnAQuiz extends JPanel {
        private JComboBox choice;
        private JLabel label;
        private JTextField text;
        Button CheckAnswer;
        Button TryAgain;
        private String Answer1 = "Wilson";
        private String Answer2 = "Ace";
        private String Answer3 = "Yes";
        private String input = " ";
        boolean Answer = false;
        JLabel testresult;
        public AnAQuiz() {
            choice = new JComboBox();
            label = new JLabel();
            label.setBackground(Color.blue);
            choice.addItem("Tennis Question #1");
            choice.addItem("Tennis Question #2");
            choice.addItem("Tennis Question #3");
            text = new JTextField(42); //step 4
            Listener listen = new Listener();
            choice.addActionListener(listen);
            add(choice);
            add(label);
            add(text);
        private class Listener implements ActionListener {
            public void actionPerformed(ActionEvent event ) {
            int c = choice.getSelectedIndex();
                switch (c) {
                case 0:
                    label.setText("Whats the famous tennis brand that begins with 'W'?");
                    if (input.equals(Answer1))testresult = new JLabel("Correct!"); //Having difficulty getting the correct and the incorrect to show as a label
                     else testresult = new JLabel("Incorrect!");
                     break;
                 case 1:
                    label.setText("What do you call when someone misses a serve?");
                    break;
                 case 2:
                    label.setText("Should you shake hands after a match?");
                    break;
        public static void main(String[] args)
            JFrame frame = new JFrame("Quiz");
             frame.getContentPane().add(new AnAQuiz());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.show();

    Basically adding in the code tjacobs01 demo'd for you and a little extra.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class AnAQuiz extends JPanel {
        private int chosen;
        private JComboBox choice;
        private JLabel label;
        private JTextField text;
        Button CheckAnswer;
        Button TryAgain;
        private String Answer1 = "Wilson";
        private String Answer2 = "Ace";
        private String Answer3 = "Yes";
        private String input = " ";
        boolean Answer = false;
        JLabel testresult = new JLabel("");
        public AnAQuiz() {
            choice = new JComboBox();
            label = new JLabel();
            label.setBackground(Color.blue);
            choice.addItem("Tennis Question #1");
            choice.addItem("Tennis Question #2");
            choice.addItem("Tennis Question #3");
            text = new JTextField(42); //step 4
            Listener listen = new Listener();
            choice.addActionListener(listen);
            setLayout(new BoxLayout(this, 0));
            add(choice);
            add(label);
            add(text);
              text.addKeyListener(new KeyAdapter() {
              public void keyPressed(KeyEvent ke) {
                if (ke.getKeyCode() == KeyEvent.VK_ENTER) {
                  input = text.getText();
                  if ( chosen == 0  &&  input.equals(Answer1) )
                    label.setText("Correct");
                  else if ( chosen == 1  &&  input.equals(Answer2) )
                    label.setText("Correct");
                  else if ( chosen == 2  &&  input.equals(Answer3) )
                    label.setText("Correct");
                  else
                    label.setText("Incorrect");
            add(testresult);
            testresult.setVisible(false);
        private class Listener implements ActionListener {
            public void actionPerformed(ActionEvent event ) {
            chosen = choice.getSelectedIndex();
            testresult.setVisible(true);
                switch (chosen) {
                case 0:
                    label.setText("Whats the famous tennis brand that begins with 'W'?");
                    break;
                 case 1:
                    label.setText("What do you call when someone misses a serve?");
                    break;
                 case 2:
                    label.setText("Should you shake hands after a match?");
                    break;
                 default:
                    break;
                text.requestFocus();
        public static void main(String[] args)
            JFrame frame = new JFrame("Quiz");
            frame.getContentPane().add(new AnAQuiz());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.pack();
            frame.setVisible(true);
    }

  • Adobe Captivate 5.5: Quiz Review for Correct and Uncorrect answers

    Hello,
    While making a quiz on Captivate 5.5, I couldn't set a review for correct and uncorrect answers. This in order to explain the correct answer.
    The review area only appears when the question is not answered. I would like to know how I can fix this or a simple trick to make text appear only when reviewing the question.
    Thanks!

    Hi and welcome to the forum,
    For Quizzes you can customize the immediate feedback by editing the Success/Failure captions. However for Review, if the user has given an incorrect answer the Text Caption has always the same content, it will indicate the given answer and the correct answer. Out of the box there is no possibility to adapt this Review message so that is more personalised for each question.
    If you do not mind some more work, I blogged about customising the Review messages. Feel free to have a look:
    Customise review messages
    Lilybiri

  • How to segragate correct and incorrect records in a msg

    Hi All,
    I am working on a file-XI(BPM)-Oracle scenario.
    My input file has a field 'Applicant No', which is mandatory in the Oracle table.
    In my BPM, I have a transformation generating two message types, one for the corect msg and the other for the error.
    Next what i am doing it by means of 'Fork Step' in BPM i am segragating these msgs and sending the correct ones to the Oracle table and the erroneous ones to a file in the sender system.
    At runtime my input file contains two records, one correct and the other incorrect.
    But both the records are getting sent two both the receivers i.e in sender an error file is getting created with both the records and both the records are also trying to get inserted into the database.
    How can i overcome this problem? Is there any step in BPM which can actuaaly seperate out the two records?
    Pls guide
    Thanks in advance
    Regards
    Neetu

    Hi,
    Please use Switch and define your condition in the swtich based on which you want the data to flow to either file or JDBC.
    From SAP Help:
    You use a fork () when you want to continue a process in branches that are independent of each other, for example, to communicate with two systems that are independent of each other. The branches of the fork join in a union operator.
    You use a switch () to define different processing branches for a process. The Otherwise processing branch is created automatically.
    You define a condition for each processing branch (see also: Condition Editor). The condition is checked at runtime. The process is continued in the branch that is first to return the value true. If no branch returns the value true, then the process is continued in the Otherwise branch.
    Regards
    Vijaya

  • How do I track number of correct and incorrect mouse clicks in Hotspot quiz?

    Hi All,
    I need to create a quiz that allows me to know how many correct answers the user has clicked (there will be 20ish) and how many clicks were incorrect. Is there anyway of doing this?
    Many Thanks
    Chris M

    Hi,
    Thanks, I am currently running version 4 of captivate. The intention is that all 20 hotspots will appear in the same slide.
    So you can get an idea of the project, it will train users how to proof documents. A document shows on screen users would then click on every error they can spot. For every hotspot not in the correct area (IE over a spelling mistake) gets marked as a different variable (IE You were wrong X times).
    Thanks
    Chris M

  • Quiz Captions for Correct & Incorrect answers

    I have a quiz in which I've deleted the Correct and Incorrect captions on each question. My boss has had a change of heart and now would like to provide feedback using these captions. In the Quiz properties, I can bring the Correct caption back onto the slide but can't seem to do the same with the Incorrect caption.  Does anyone know of a way I can get this done?

    Try putting Failure Levels at something else than None
    Lilybiri

  • Correct vs. helpful answer vs. the rest

    How are "correct" and "helpful" answers defined?
       Kind regards
       Peter Larsen

    On top of all that (*which I thought I understood for a moment, but now I'm not so sure...) I've just had one of those revalatory insights:
    I now realise why the FAQs all went - they had to. The very idea of finding a correct answer on your own runs completely contrary to the idea of awarding brownie points, doesn't it? I mean, we couldn't possibly have anybody actually looking something up for themselves, because then there would be no mechanism for allocating the person responsible for creating the FAQ with the 'correct answer' points. So it was inevitable, really...
    I rather get the impression that whoever came up with these hair-brained ideas about how a forum ought to work never actually participated in using one. And the same goes for anybody who chose to use the software subsequently for their own one. And the more I look at it, the worse it gets; this garbage ought to sink without trace.
    *Add answers at your own peril, the workings of the point system are as yet undocumented and you may risk losing answer-points already earned since any added information after the CORRECT answer will constitute incorrect and possibly heretic answers.
    This is where it gets even more confusing - certainly conceptually. Can you have a correct answer and a more correct answer? Or does the more correct answer make the correct answer more wrong? And is that the same as less right? I don't think that I'll lose any points for adding this because it doesn't make the definitive answer any more or less correct - because correct is clearly a moveable feast anyway and this is a tangential point. I can't have any points for that though, because the software doesn't allow for vector analysis of responses...

  • Show Incorrect Answers Upon Review

    Can you set Captivate 8 to show incorrect answers upon review? It is showing correct answers but I can't figure out how to make it show incorrect answers too.

    By default Captivate will show both correctly answered questions and incorrectly answered questions.
    There is no 'option' to show ONLY one or the other during review.  You would need to set up user variables for each question slide to track whether it was answered correctly or not and then check these user variables with conditional actions ON SLIDE ENTER of the question slides when in Review Mode.  There is a system variable you can use to check for Review Mode.

  • My ipad receives email with the hotel wifi but will not send.  The error message is "user name or password for ........is incorrect" but both are correct and unchanged.  Restarting iPad didnt help.

    My iPad receives email on the hotel wifi but will not send.  The error message reads "user name or password for smpt......is incorrect" but both are correct and unchanged.  Restarting iPad did not help.

    I did try this too, but when I access my webmail on the iPad, the iPad doesn't allow me to type my message.  I am able to enter in the "to" address and the "subject" line, but then the keyboard will not come up for me to type my message.  Is there some trick to this?  Very frustrating!

  • Captivate 7 - Incorrect Answers not allowing quiz to Continue. Buttons not functioning correctly (Clear, Back, Next). I have Knowledge Check

    I am experiencing a problem with the Quiz feature of Captivate 7. Correct answers are submitting o.k., but Incorrect answers are not. You cannot go forward with them, i.e., the program will not Continue or go to the next question with an Incorrect answer in the Assessment.
    This presentation has 15 Knowledge Check questions (0 points) and 10 Assessment Questions (10 points each).
    Also the buttons don't always work correctly, i.e. Clear, Next, Back.
    What could I try?

    Thank you for your response. No. I didn't do anything like that. I figured that I should probably divide this into 2 parts and aggregate them. That was going to work, but  I checked with one of our other users in TX. He told me that what they always do is to divide up the presentations into 2 parts. They don't aggregate them, but instead, let the LMS take care of going from the learning module (with the Knowledge Check questions) to the Assessment Module. Once you exit from the learning module, you immediately go into the assessment.
    Captivate 7 doesn't really allow for this type of test without aggregation or an LMS. You can have a pre-test, but it expects those questions to come at the beginning of the course, not to be interspersed throughout the course. I also found that using the Question Pools gave me more flexibility in moving Knowledge Check questions around using the Filmstrip.
    The other interesting thing was that the TX expert told me to remove the Accessibility Feature because, apparently, it causes other parts of Captivate not to work. I found that to be strange.

  • HT201320 Hi, I cannot access my gmail from my iphone. The password is correct and I can access fine from my computer but the iphone keeps telling me the password is incorrect. Any ideas?

    Hi, I cannot access my gmail from my iphone. The password is correct and I can access fine from my computer but the iphone keeps telling me the password is incorrect. Any ideas?

    I believe Gmail has an option for Two-Step verification that may require a different password for mobile devices than for your computer.
    https://support.google.com/mail/answer/2703311?hl=en

  • It say that the encrypt code i put is incorrect it is correct and now i cant back up my new iphone help pls

    It say that the encrypt code i put is incorrect it is correct and now i cant back up my new iphone help pls

    Does the account require SSL to be enabled?  Check to see if it is.

  • TS1368 My account keeps asking for Region but the drop down menu lists Cities in China. I can,'t cange the region in my account because it asks me to check the date and time but these are correct. Any answers please?

    My account keeps asking for Region but the drop down menu lists Cities in China. I can,'t cange the region in my account because it asks me to check the date and time but these are correct. Any answers please?

    Look, I understand I still need a card attached to the account. The problem is, it won't accept my card because I only have 87 cents in my bank account right now.
    If I had known there would be so much trouble with the iTunes card, I would have just put the cash in my bank account in the morning instead of buying an iTunes card (I didn't expect the banks to be open on Thanksgiving of course).
    Apple will only accept cards that have a balance. The balance is so small in my account that it won't accept it as a valid card.
    I'm going to have to contact Apple anyway to reset the security questions. That's obvious. Your answers were not exactly helpful. You didn't tell me anything I don't already know, but thanks for trying to be helpful.

  • When importing DV, Event dates jumbled and incorrect. How to correct dates?

    When I import DV tapes into iM 08 the date that I imported them was correct and putting them in order under the year 2007. Then at about my 16th tape the Event went under the year 2016 then the next one 2019 then the next one 2002????? How can I reset the dates to put the imports back into the right order with the right dates?
    One more question: I accidently added an imported DV to an existing event. Is there anyway to seperate them into seperate events as they should have been?
    Thanks
    Kevin

    http://discussions.apple.com/message.jspa?messageID=5438022#5438022
    This thread discusses several solutions, or you can follow the link to Karsten's webpage, which summarizes them.
    To split an Event:
    In the Event that you want to divide, click the clip that you want to become the first clip of the new Event.
    Choose File > “Split Event Before Selected Clip.”

  • HT1725 My purchase was stopped and security questions asked. I did not answer correctly and no options given to reset

    Song download interrupted and security question not answered correctly and now I'm here

    If you have a rescue email address (which is not the same thing as an alternate email address) set up on your account then you can try going to https://appleid.apple.com/ and click 'Manage your Apple ID' on the right-hand side of that page and log into your account. Then click on 'Password and Security' on the left-hand side of that page and on the right-hand side you might see an option to send security question reset info to your rescue email address.
    If you don't have a rescue email address then see if the instructions on this user tip helps : https://discussions.apple.com/docs/DOC-4551

Maybe you are looking for

  • 10.6.8 unusable after Security Update

    I've talked to The AppleWorks group but without resolution: my iMac with 10.6.8 ran well until the latest Security Update (2012-001  vs. 1.1) Now AppleWorks won't run properly (under Rosetta). I can save nothing ("Unexpected error occurred #-51"). I

  • New laptop. Do I have to uninstall LR3.6, CS5, & El 8?

    I bought a new laptop.  Windows 7, 64 bit.  I spend 99% of my time in Lightroom, and I would like to upgrade to LR4.  I also have a 14" laptop with XPPro+, SP3, Core 2 Duo [email protected]  From what I've read, LR4 probably will not run on this mach

  • Airport and Distribution !??

    Hi All, I have a plan... Dangerous I know, however I'm not sure if it would work. In the near future I will be in a situation where my internet will be coming from a shared source (will be a WiFi hotspot in a marina) I will most likely be issued a fi

  • I selected block pop-ups but now they are getting worse.

    I would like to know how to get the preference to block pop-ups to work. I have an iMac. Thanks, Ian

  • There is a discrepency between what my iPod actually has on it vs. what my iTunes says it has on it.

    When I look at what is on my iPod through my computer (iTunes) it says I have all the playlists I'm trying to add: However, when I look at my actual iPod, this is what I have: Some playlists are missing AND it keeps adding new (and empty) "genius pla