title: Stop app from crashing when submitting order with empty EditText
body: <p>I have recently started to learn programming and am writing a coffee ordering app. I have a "price" field where you enter the basic price for a cup of coffee and some other options. Right now if I click the "Order" button when the price field is empty the app crashes. I tried to add the line of code from the question about is it possible to have both default value and hint in an EditText.
  Here is the bit of code of the method that calculates the price, the check boxes are check boxes for toppings on the coffee and function well:</p>
  
  <pre><code>// Calculates the price
  private int calculatePrice(int quantity) {
      // Price per cup in field
      EditText pricePerCupF = (EditText) findViewById(R.id.basic_price);
      boolean whippedChecked = ((CheckBox) findViewById(R.id.whipped_cream)).isChecked();
      boolean chocolateChecked = ((CheckBox) findViewById(R.id.chocolate)).isChecked();
      int pricePerCup = Integer.parseInt(pricePerCupF.getText().toString());
      if (whippedChecked) {
          pricePerCup += 1;
      }
      if (chocolateChecked) {
          pricePerCup += 1;
      }
      if (pricePerCupF.getText().toString().equals("")) {
          return 0;
      }
      else {
  
          int price = pricePerCup * quantity;
          return price;
      }
  </code></pre>
  
  <p>Thanks!</p>