1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
public class Extrudeur extends AppCompatActivity {
private Button calcul;
private EditText longa,longb,longc,stepa;
private TextView stepb;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_extrudeur);
longa = (EditText) findViewById(R.id.longa);
longb = (EditText) findViewById(R.id.longb);
longc = (EditText) findViewById(R.id.longc);
stepa = (EditText) findViewById(R.id.stepa);
stepb = (TextView) findViewById(R.id.stepb);
calcul= (Button) findViewById(R.id.calcul);
calcul.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String longanum = longa.getText().toString();
String longbnum = longb.getText().toString();
String longcnum = longc.getText().toString();
String stepanum = stepa.getText().toString();
Integer calcul1 = Integer.parseInt(longbnum) - Integer.parseInt(longbnum);
Integer calcul2 = calcul1 * Integer.parseInt(stepanum);
Integer calcul3 = Integer.parseInt(longbnum) - Integer.parseInt(longcnum);
Integer resultat = calcul2 / calcul3;
stepb.setText("Step = " + Integer.toString(resultat));
}
});
}
} |
Partager