Can't figure out how to Get rid of NaN
<p>Ok so i am bulding this application that calculates 3 input boxes. i am getting a NaN when doing some calculations with 0 values.<br>
here is the main.xml </p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;


&lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:id="@+id/ScrollView01" &gt;




&lt;AbsoluteLayout android:orientation="vertical"
    android:layout_width="fill_parent" android:layout_height="fill_parent"&gt;



    &lt;EditText android:id="@+id/InputNumber01"
        android:numeric="integer|decimal" android:imeOptions="actionNext"
        android:textStyle="bold" android:hint="Service Call"
        android:layout_x="5dip" android:layout_y="5px" android:layout_height="55dip"
        android:textSize="20dip" android:layout_width="195dip"
        android:selectAllOnFocus="true" android:inputType="numberDecimal"/&gt;



    &lt;EditText android:id="@+id/InputNumber02"
        android:numeric="integer|decimal" android:inputType="numberDecimal"
        android:textStyle="bold" android:hint="Parts" android:layout_x="5dip"
        android:layout_y="90px" android:layout_height="55dip"
        android:textSize="20dip" android:layout_width="195dip"
        android:selectAllOnFocus="true" android:imeOptions="actionNext"/&gt;



    &lt;EditText android:id="@+id/InputNumber03" android:numeric="integer|decimal"
        android:inputType="numberDecimal" android:textStyle="bold"
        android:hint="Labor" android:layout_x="5dip" android:layout_y="175px"
        android:layout_height="55dip" android:textSize="20dip"
        android:layout_width="195dip" android:selectAllOnFocus="true"
        android:imeOptions="actionDone"/&gt;

    &lt;Button android:text="Calculate" android:id="@+id/actionButton"

        android:textStyle="bold" android:layout_height="50dip"
        android:layout_width="fill_parent" android:layout_y="300px"
        android:textSize="15dip" /&gt;


    &lt;TextView android:id="@+id/TextResult" android:layout_height="wrap_content"
        android:numeric="integer|decimal" android:textStyle="bold"
        android:layout_width="85dip" android:layout_x="225dip"
        android:layout_y="175dip" android:gravity="left" android:textSize="18dip"
        android:textColor="#1d9ee2" /&gt;



    &lt;TextView android:layout_height="wrap_content" android:id="@+id/TextView04"
        android:text="Total:" android:textStyle="bold" android:gravity="right"
        android:layout_width="55dip" android:layout_y="175dip"
        android:layout_x="165dip" android:textSize="18dip" /&gt;

    &lt;TextView android:layout_height="wrap_content" android:id="@+id/TextView05"
        android:text="Total Labor:" android:layout_y="260dip"
        android:layout_width="95dip" android:layout_x="5dip" android:gravity="right" /&gt;

    &lt;TextView android:text="@+id/TotalLabor"
        android:layout_height="wrap_content" android:layout_width="wrap_content"
        android:id="@+id/TotalLabor" android:layout_y="260dip"
        android:layout_x="110dip" /&gt;

    &lt;TextView android:layout_height="wrap_content" android:id="@+id/TextView06"
        android:layout_x="5dip" android:text="Total Services:"
        android:layout_y="280dip" android:layout_width="95dip"
        android:gravity="right" /&gt;

    &lt;TextView android:layout_height="wrap_content"
        android:layout_width="wrap_content" android:id="@+id/TotalServices"
        android:text="@+id/TotalServices" android:layout_y="280dip"
        android:layout_x="110dip" /&gt;

    &lt;TextView android:id="@+id/TextView07" android:text="SC Tax %:"
        android:layout_y="300dip" android:layout_height="wrap_content"
        android:layout_x="5dip" android:layout_width="95dip" android:gravity="right" /&gt;

    &lt;TextView android:text="@+id/TextView08"
        android:layout_height="wrap_content" android:layout_width="wrap_content"
        android:id="@+id/SCTaxPercent" android:layout_y="300dip"
        android:layout_x="110dip" /&gt;

    &lt;TextView android:layout_height="wrap_content" android:id="@+id/TextView08"
        android:text="Sales Tax:" android:textStyle="bold" android:layout_y="175dip"
        android:layout_x="5dip" android:textSize="18dip"
        android:layout_width="wrap_content" android:gravity="right" /&gt;

    &lt;TextView android:layout_height="wrap_content" android:id="@+id/SalesTax"
        android:textStyle="bold" android:numeric="integer|decimal"
        android:layout_y="175dip" android:gravity="left"
        android:layout_width="65dip" android:textSize="18dip"
        android:layout_x="100dip" /&gt;

    &lt;TextView android:layout_height="wrap_content" android:id="@+id/TextView09"
        android:text="SC Taxable:" android:layout_y="320dip"
        android:layout_x="5dip" android:layout_width="95dip" android:gravity="right" /&gt;

    &lt;TextView android:layout_height="wrap_content" android:text="@+id/TextView10"
        android:layout_width="wrap_content" android:id="@+id/ScTaxable"
        android:layout_y="320dip" android:layout_x="110dip" /&gt;

    &lt;TextView android:layout_height="wrap_content" android:id="@+id/TextView10"
        android:text="Taxable:" android:layout_y="340dip"
        android:layout_width="95dip" android:layout_x="5dip" android:gravity="right" /&gt;

    &lt;TextView android:layout_height="wrap_content" android:text="@+id/TextView11"
        android:layout_width="wrap_content" android:id="@+id/Taxable"
        android:layout_y="340dip" android:layout_x="110dip" /&gt;

    &lt;EditText android:layout_height="wrap_content" android:text="9.50"
        android:layout_width="90dip" android:id="@+id/SalesTaxValue"
        android:layout_x="5dip" android:layout_y="430dip" android:numeric="integer|decimal"
        android:selectAllOnFocus="true" /&gt;

    &lt;TextView android:layout_height="wrap_content" android:id="@+id/TextView01"
        android:layout_width="wrap_content" android:layout_x="5dip"
        android:text="Sales Tax Value:" android:layout_y="407dip" /&gt;
&lt;/AbsoluteLayout&gt;
&lt;/ScrollView&gt;
</code></pre>

<p>and this is the calculator.java </p>

<pre><code>package com.Eddie.TaxCalculator;

import java.text.NumberFormat;

import com.Eddie.TaxCalculator.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class Calculator extends Activity {
    private Button calculateButton;
    private EditText inputField01;
    private EditText inputField02;
    private EditText inputField03;
    private EditText salesTaxValue;
    private double serviceCall;
    private double parts;
    private double labor;
    private double salestaxvalue;


String zero ="0";

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        calculateButton = (Button) findViewById(R.id.actionButton);
        calculateButton.setOnClickListener(doSomethingNow);
        this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);

        }

    private OnClickListener doSomethingNow = new OnClickListener() {
        public void onClick(View arg0) {
            inputField01 = (EditText) findViewById(R.id.InputNumber01);
            inputField02 = (EditText) findViewById(R.id.InputNumber02);
            inputField03 = (EditText) findViewById(R.id.InputNumber03);
            salesTaxValue = (EditText) findViewById(R.id.SalesTaxValue);


            if (inputField01.getText().toString().length()==0)
                    {
                       inputField01.setText(zero);
                    Toast toast = Toast.makeText(getApplicationContext(), 
                            "Service Call TextBox was empty.",
                            Toast.LENGTH_LONG);
                    toast.show();
                    }       
            if(inputField02.getText().toString().length()==0)
                    {
                       inputField02.setText(zero);
                    Toast toast = Toast.makeText(getApplicationContext(), 
                            "Parts TextBox was empty.",
                            Toast.LENGTH_LONG);
                    toast.show();
                    }   
            if(inputField03.getText().toString().length()==0)
                    {
                       inputField03.setText(zero);
                    Toast toast = Toast.makeText(getApplicationContext(), 
                            "Labor TextBox was empty.",
                            Toast.LENGTH_LONG);
                    toast.show();
                    }
            //service Call is 0
            if (inputField01.getText().toString().equals("0"))
            {
            Toast toast = Toast.makeText(getApplicationContext(), 
                    "Service Call TextBox value is 0.",
                    Toast.LENGTH_SHORT);
            //toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
            toast.show();
            }       
            //Parts is 0
                if (inputField02.getText().toString().equals("0"))
            {
               //inputField01.setText("10");
            Toast toast = Toast.makeText(getApplicationContext(), 
                    "Parts TextBox value is 0.",
                    Toast.LENGTH_SHORT);
            toast.show();
            }   
            //Labor is 0
            if (inputField03.getText().toString().equals("0"))
            {
               //inputField01.setText("10");
            Toast toast = Toast.makeText(getApplicationContext(), 
                    "Labor TextBox value is 0.",
                    Toast.LENGTH_SHORT);
            toast.show();
            }   


            serviceCall = Double.parseDouble(inputField01.getText().toString());
            parts = Double.parseDouble(inputField02.getText().toString());
            labor = Double.parseDouble(inputField03.getText().toString());
            salestaxvalue = Double.parseDouble(salesTaxValue.getText().toString());

            NumberFormat numberFormat = NumberFormat.getInstance();
            numberFormat.setMaximumFractionDigits(2);            
            numberFormat.setGroupingUsed(false); 



            TextView totalLabor = (TextView)findViewById(R.id.TotalLabor);
            Double totalLaborResults =  serviceCall +  labor;
            String totalLaborCalcInt = numberFormat.format(totalLaborResults).toString();
            totalLabor.setText (totalLaborCalcInt);

            TextView totalServices = (TextView)findViewById(R.id.TotalServices);
            Double totalServicesResults = (parts + labor);
            String totalServicesCalcInt = numberFormat.format(totalServicesResults);
            totalServices.setText (totalServicesCalcInt);


            TextView servicecallTaxpercent = (TextView)findViewById(R.id.SCTaxPercent);
            Double scTaxPercentResults =  (parts / totalServicesResults);
            String serviceCallPercentCalcInt =  numberFormat.format(scTaxPercentResults).toString();
            servicecallTaxpercent.setText (serviceCallPercentCalcInt);

            TextView scTaxable = (TextView)findViewById(R.id.ScTaxable);
            Double scTaxableResults = (serviceCall * scTaxPercentResults);
            String serviceCallTaxableCalcInt =numberFormat.format (scTaxableResults).toString();
            scTaxable.setText (serviceCallTaxableCalcInt);

            TextView taxable = (TextView)findViewById(R.id.Taxable);
            Double taxableResults = (parts + scTaxableResults);             
            String taxableCalcInt =numberFormat.format (taxableResults).toString();
            taxable.setText (taxableCalcInt);

            TextView salesTax = (TextView)findViewById(R.id.SalesTax);
            Double salesTaxResults = (taxableResults * salestaxvalue) /100;
            String salesTaxCalcInt = numberFormat.format (salesTaxResults).toString();
            salesTax.setText (salesTaxCalcInt);

            TextView textResult = (TextView)findViewById(R.id.Total);
            Double additionResults = (salesTaxResults + parts+ serviceCall +  labor);
            String TotalCalcInt = numberFormat.format(additionResults).toString();
            textResult.setText (TotalCalcInt);

                }

    };

};
</code></pre>

<p>when entering a number in input 1 (service Call) and zeros in the two other inputs i get a NaN Total. </p>

<p>if All input Boxes are zero value i also get a NaN total, NaN sale Tax, NaN scTax % textview (sc is short of Service Call) 
NaN scTaxable, NaN taxable. </p>

<p>could anyone help me find this but i've been trying for two weeks now. 
pls help. </p>
