Read this
http://download.oracle.com/javase/1.4.2/docs/api/java/lang/Math.html (or a
newer version) and try to implement the formula. If you have any problem
come back.
On Sep 19, 2011 9:42 PM, "leigh8347" <[email protected]> wrote:
> I am currently working on an app that takes 4 user input values and
> puts them through the following equation and gives an answer. The only
> thing is that it wont work.
>
> the equation is as follows.
>
> answer = max { round ( (value1 / 10.9375)+(value2 / 9.2105)+(value3 /
> 3.889)-(value4 / 12.5) ) ,0 }
>
> so far i have the following
>
>
> package com.android.app;
>
> import android.app.Activity;
> import android.os.Bundle;
> import android.view.View;
> import android.widget.Button;
> import android.widget.EditText;
> import android.widget.TextView;
>
> public class Equation extends Activity {
>
> Button submit;
> EditText val1,val2,val3,val4r;
> TextView answer;
>
> /** Called when the activity is first created. */
> @Override
> public void onCreate(Bundle savedInstanceState) {
> super.onCreate(savedInstanceState);
>
> /* First Tab Content */
> setContentView(R.layout.equation);
>
> val1 = (EditText) findViewById(R.id.value1);
> val2 = (EditText) findViewById(R.id.value2);
> val3 = (EditText) findViewById(R.id.value3);
> val4 = (EditText) findViewById(R.id.value4);
> submit = (Button) findViewById(R.id.submit);
> answer = (TextView) findViewById(R.id.answer);
> submit.setOnClickListener(new clicker());
> }
> class clicker implements Button.OnClickListener
> {
>
> public void onClick(View v)
> {
> String a,b,c,d;
> Integer Int;
> a = val1.getText().toString();
> b = val2.getText().toString();
> c = val3.getText().toString();
> d = val4.getText().toString();
> Int = max { round ( (a / 10.9375)+(b / 9.2105)+(c / 3.889)-
> (d / 12.5) ) ,0 }
>
> points.setText(Int.toString());
> }
> }
> }
>
>
> so... thats what i have, can you help?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to