thank you!
import javax.swing.*; import java.awt.*; import java.awt.event.*; public class HedgeYourBet extends JFrame { public static void main (String[] arg) { HedgeYourBet window = new HedgeYourBet(); window.setVisible(true); } JLabel title = new JLabel("There is only 1 correct answer for each question."); JLabel one = new JLabel("If you choose 1 correct answer = 5 pts"); JLabel two = new JLabel("2 answers(with the 1 correct) = 2 pts"); JLabel three = new JLabel("all 3 answers = 1 pt"); JLabel direction = new JLabel("Choose the correct answer for x in each equation below"); String q1 = ("Q1) 1x + -1 = 0"); String q2 = ("Q2) 14x - 7 = 21"); String q3 = ("Q3) 5x + 5 = 10"); String q4 = ("Q4) x + 5 = 2x + 2"); String q5 = ("Q5) 3x - 5 = 2x - 4"); JLabel question = new JLabel(q1); JCheckBox q1a = new JCheckBox("x = 1"); JCheckBox q1b = new JCheckBox("x = 2"); JCheckBox q1c = new JCheckBox("x = 3"); JButton submit = new JButton("Submit"); int point = 0; JLabel points = new JLabel ("You have "+point+" points"); public HedgeYourBet() { setTitle("Quiz Game"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(300,600); Container pane = getContentPane(); pane.setLayout(new FlowLayout());; pane.add(title); pane.add(one); pane.add(two); pane.add(three); pane.add(direction); pane.add(question); JPanel one = new JPanel(); one.add(q1a); one.add(q1b); one.add(q1c); JPanel submit2 = new JPanel(); submit2.add(submit); submit2.add(points); pane.add(one); pane.add(submit2); ClickButtonListener clickListener = new ClickButtonListener(); submit.addActionListener(clickListener); } public class ClickButtonListener implements ActionListener { public void actionPerformed (ActionEvent e) { if (question.equals(q1)) { if(q1c.isSelected() && q1b.isSelected() && q1a.isSelected()) { point += 1; } else if(q1a.isSelected() && q1b.isSelected() && !q1c.isSelected() || q1a.isSelected() && q1c.isSelected() && !q1b.isSelected() ) { point += 2; } else if(q1a.isSelected() && !q1b.isSelected() && !q1c.isSelected()) { point +=5; } } points.setText("You have "+point+" points"); question.setText(q2); if (question.equals(q2)) { if(q1c.isSelected() && q1b.isSelected() && q1a.isSelected()) { point += 1; } else if(q1b.isSelected() && q1a.isSelected() && !q1c.isSelected() || q1b.isSelected() && q1c.isSelected() && !q1a.isSelected() ) { point += 2; } else if(q1b.isSelected() && !q1a.isSelected() && !q1c.isSelected()) { point +=5; } } points.setText("You have "+point+" points"); question.setText(q3); if (question.equals(q3)) { if(q1c.isSelected() && q1b.isSelected() && q1a.isSelected()) { point += 1; } else if(q1a.isSelected() && q1b.isSelected() && !q1c.isSelected() || q1a.isSelected() && q1c.isSelected() && !q1b.isSelected() ) { point += 2; } else if(q1a.isSelected() && !q1b.isSelected() && !q1c.isSelected()) { point +=5; } } points.setText("You have "+point+" points"); question.setText(q4); if (question.equals(q4)) { if(q1c.isSelected() && q1b.isSelected() && q1a.isSelected()) { point += 1; } else if(q1c.isSelected() && q1b.isSelected() && !q1a.isSelected() || q1c.isSelected() && q1a.isSelected() && !q1b.isSelected() ) { point += 2; } else if(q1c.isSelected() && !q1b.isSelected() && !q1a.isSelected()) { point +=5; } } points.setText("You have "+point+" points"); question.setText(q5); if (question.equals(q5)) { if(q1c.isSelected() && q1b.isSelected() && q1a.isSelected()) { point += 1; } else if(q1a.isSelected() && q1b.isSelected() && !q1c.isSelected() || q1a.isSelected() && q1c.isSelected() && !q1b.isSelected() ) { point += 2; } else if(q1a.isSelected() && !q1b.isSelected() && !q1c.isSelected()) { point +=5; } } points.setText("You have "+point+" points"); /* if (point <= 10) { question.setText("Try Again!"); } else if (point >= 10) { question.setText("Congrats!"); } */ } } }
some reason it jumps from q1 to q5, and discarding going from q1 to q2 and from q2 to q3