mercredi 19 juin 2019

get result of calculation inside if ese statment

// im developing an application that making a math calculating, a button is calling a method where the calculations take place , after verifying the condition of if./

 public class MainActivity extends AppCompatActivity {


  Button ok;
  TextView re;
  EditText s ;
  int   ref =100 ;
  int=12;
  int=8;


 @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(R.layout.activity_main);

 re=findViewById(R.id.result);
 ok =findViewById(R.id.ok);
 s=findViewById(R.id.somme);
  int en = Integer.parseInt(s.getText().toString());






    if (en <(ref)) {
        int result =((en*8)/ 100);


        System.out.println(result);
    } else {

        int result1=((en*12)/ 100);
        System.out.println(result1);
    }


    }


   }

*// thank you

Aucun commentaire:

Enregistrer un commentaire