title: Every time I divide I get 0.0
body: <p>I am trying to make an app that splits the bill between people but whenever i try to divide the two numbers in the code it always gives me 0.0 . Why is this?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>public class MainActivity extends Activity {
      public int x = 0;
      public double y = 1.00;
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          //Button
          Button btn = (Button) findViewById(R.id.button);
  
          //EditText
          EditText nop = (EditText) findViewById(R.id.editText);
          EditText cob = (EditText) findViewById(R.id.editText2);
  
  
          try{
              x = Integer.valueOf(nop.getText().toString());
          } catch (NumberFormatException e) {
              x = 0;
          }
  
          try{
              y = Double.valueOf(cob.getText().toString());
          } catch (NumberFormatException e) {
              y = 1.00;
          }
  
  
          //TextView
          final TextView tv = (TextView) findViewById(R.id.textView);
  
          btn.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
  
                   Double z = (y / x);
                  tv.setText("You will each pay:" + (z));
              }
          });
  
      }
      }
  </code></pre>