开发者

Android Average calculation string

开发者 https://www.devze.com 2023-04-13 04:01 出处:网络
I have this application that Ihave written to calculate average. It comes up on the emulator but it wont calculate the average. I suspect its something with the string but i\'m not positive. any ideas

I have this application that I have written to calculate average. It comes up on the emulator but it wont calculate the average. I suspect its something with the string but i'm not positive. any ideas?

开发者_JS百科    import android.app.Activity;
    import android.os.Bundle;
    import android.view.*;
    import android.widget.*; 
    import android.view.View.OnClickListener;
    public class AvgActivity extends Activity {
    /** Called when the activity is first created. */
    Button bu1=null;
    EditText et1=null;
    EditText et2=null;
    EditText et3=null; 

    @Override

    public void onCreate(Bundle savedInstanceState) {

       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
       bu1=(Button)findViewById(R.id.bu1);
       et1=(EditText)findViewById(R.id.et1); 
       et2=(EditText)findViewById(R.id.et2);
       et3=(EditText)findViewById(R.id.et3); 
       bu1.setOnClickListener(new View.OnClickListener(){ 

              public void onClick(View v){ 
              }
          }
       });

       double num;

       public double mean(double[] m) {
            double sum = 0;
            for (int i = 0; i < double.length; i++)
            {
                sum += m[i];
            }
            return sum / double.length;
       }
}


  public double mean(double[] m) {
    double sum = 0;
    for (int i = 0; i < m.length; i++) {
        sum += m[i];
    }
    return sum / m.length;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消