import android.widget.*;
import android.view.*;
import android.view.View.OnClickListener;
public class MainActivity extends
Activity {
Button b1;
EditText t1,t2,t3,t4;
@Override
protected void
onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
t1=(EditText)
findViewById(R.id.editText1);
t2=(EditText)
findViewById(R.id.editText2);
t3=(EditText)
findViewById(R.id.editText3);
t4=(EditText)
findViewById(R.id.editText4);
b1=(Button)
findViewById(R.id.button1);
b1.setOnClickListener(s1);
}
public
OnClickListener s1=new OnClickListener()
{
public void
onClick(View v){
if(v==b1){
float
p=Float.parseFloat(t1.getText().toString());
float
n=Float.parseFloat(t2.getText().toString());
float
r=Float.parseFloat(t3.getText().toString());
float
si=p*n*r/100;
t4.setText(String.valueOf(si));
}
}};}
No comments:
Post a Comment