title: Bill Splitter Calculator Android App Program Logic
body: <p>I'm trying to create an Android app to help to calculate split the bill if let's say you're eating out in a party of 2 people or more.</p>
  
  <p>You're supposed to enter the subtotal of the bill, enter the number of people in the party, enter applicable discount if any, there are 2 checkboxes for 7% tax, and 10% service charges if it hasn't been included in the bill yet. Finally you just need to click on the "calculate button" for the app to calculate how much each person has to pay.</p>
  
  <p>The program takes the subtotal amount when user inputs it,
  calculate the additional discount if there's any, take the amount after discount,
  calculate the additional 7% GST tax if the checkbox is checked, or doesn't do anything if it's unchecked
  calculate the additional 10% tips if the checkbox is checked, or doesn't do anything if it's unchecked.</p>
  
  <p>I am unsure of my implementation of the program's logic, will also appreciate if someone can check on it and give feedback. The Logic of the app is supposed to be:</p>
  
  <p>Here's the code that I wrote:</p>
  
  <pre><code>    gst = (CheckBox) findViewById(R.id.cbCheck1);
      gst.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { 
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              if (gst.isChecked()) {
                  result = result + (0.07 * result);
              } else {
                  result = result;
              }
          }
      });
  
  
      tips = (CheckBox) findViewById(R.id.cbCheck2);
      tips.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
          public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
              if (tips.isChecked()) {
                  result = result + (0.1 * result);
              } else {
                  result = result;
              }
          }
      });  
  
      //Initialize EditTexts
      String amount = enterAmount.getText().toString();
      double subtotal = Double.valueOf(amount).doubleValue();
  
      String diners = numberDiners.getText().toString();
      int people = Integer.parseInt(diners);
  
      String disc = enterDiscount.getText().toString();
      int discount = Integer.parseInt(disc);
      double discounted = discount / 100;
  
      result = (1 - discounted) * (subtotal / people);  
  </code></pre>
  
  <p>Thank you in advance for all of your kind feedbacks.</p>