Operaciones aritmeticas utilizando_radio_button(2)

10
OPERACIONES ARITMETICAS UTILIZANDO RADIO BUTTON DANIEL CORTES BLANCO GIEZI JESUS VERA JOSE ALBERTO GALLEGOS VAZQUEZ

Transcript of Operaciones aritmeticas utilizando_radio_button(2)

Page 1: Operaciones aritmeticas utilizando_radio_button(2)

OPERACIONES

ARITMETIC

AS UTILIZANDO

RADIO BUTTON

DANIEL CORTES BLANCO

GIEZ I JESUS VERA

JOSE ALBERTO G

ALLEGOS

VAZQUEZ

Page 2: Operaciones aritmeticas utilizando_radio_button(2)

A

Abrimos nuestro nuevo proyecto de aplicación android

Page 3: Operaciones aritmeticas utilizando_radio_button(2)

Le damos un nombre

Page 4: Operaciones aritmeticas utilizando_radio_button(2)

Eliminamos el hello world

Page 5: Operaciones aritmeticas utilizando_radio_button(2)

Creamos los text view,los radiobutton, los plain text y el button

Page 6: Operaciones aritmeticas utilizando_radio_button(2)

AGREGAMOS EL SIGUIENTE CODIGO public void operar(View view) {        EditText et1=(EditText)findViewById(R.id.et1);        EditText et2=(EditText)findViewById(R.id.et2);        TextView tv3=(TextView)findViewById(R.id.tv3);          RadioButton radio0=(RadioButton)findViewById(R.id.radio0);        RadioButton radio1=(RadioButton)findViewById(R.id.radio1);                       int nro1=Integer.parseInt(et1.getText().toString());        int nro2=Integer.parseInt(et2.getText().toString());       

Page 7: Operaciones aritmeticas utilizando_radio_button(2)

               if (radio0.isChecked()==true) {            int suma=nro1+nro2;            String resu=String.valueOf(suma);            tv3.setText(resu);        } else            if (radio1.isChecked()==true) {                int resta=nro1-nro2;                String resu=String.valueOf(resta);                tv3.setText(resu);                           }      }            

Page 8: Operaciones aritmeticas utilizando_radio_button(2)
Page 9: Operaciones aritmeticas utilizando_radio_button(2)

Lo corremos..

Page 10: Operaciones aritmeticas utilizando_radio_button(2)

LISTO