title: Keep getting this error: "variable total might not have been initialized"
body: <p>I really don't know what is the problem because total is initialized as the program will always start with case 1 because click initially is equal to 1. Where do I have to initialize it, or what is the problem?</p>
  
  <pre><code>enterBut.addActionListener(new ActionListener()
          {
                 public void actionPerformed(ActionEvent e)
                 {
  
                  switch(click)
                      {
  
                        case 1:
                            double subtotal = Double.parseDouble(Atext.getText());
                            double total = 0.05*Math.round(1.13*subtotal/0.05);
                            answer.setText("The total will be $" + total + " (tax included). Enter the amount of money the customer gave.");
                            int click = 2;
  
                        case 2:
                            double money = Double.parseDouble(Atext.getText());
                            click = 3;
                            if (money&lt;total)
                            {
                                JOptionPane.showMessageDialog(window, "That is not enough money.");
                                click = 2;
                            }
                      }
  
                 }
  
          });
  </code></pre>