Practica 7 edhiel
Click here to load reader
-
Upload
eduardo-medina -
Category
Food
-
view
121 -
download
0
Transcript of Practica 7 edhiel
![Page 1: Practica 7 edhiel](https://reader037.fdocuments.mx/reader037/viewer/2022100803/58e859611a28ab78478b615d/html5/thumbnails/1.jpg)
PRACTICA 7 .-OPERACIONES ARITMETICAS UTILIZANDO CHECKBOX
EDHIEL MEDINA TELLO
4°Am PG
![Page 2: Practica 7 edhiel](https://reader037.fdocuments.mx/reader037/viewer/2022100803/58e859611a28ab78478b615d/html5/thumbnails/2.jpg)
A
Abrimos nuestro nuevo proyecto de aplicación android
![Page 3: Practica 7 edhiel](https://reader037.fdocuments.mx/reader037/viewer/2022100803/58e859611a28ab78478b615d/html5/thumbnails/3.jpg)
Le damos un nombre
![Page 4: Practica 7 edhiel](https://reader037.fdocuments.mx/reader037/viewer/2022100803/58e859611a28ab78478b615d/html5/thumbnails/4.jpg)
Eliminamos el hello world
![Page 5: Practica 7 edhiel](https://reader037.fdocuments.mx/reader037/viewer/2022100803/58e859611a28ab78478b615d/html5/thumbnails/5.jpg)
Creamos los text view,losradiobutton, los plain text y el button
![Page 6: Practica 7 edhiel](https://reader037.fdocuments.mx/reader037/viewer/2022100803/58e859611a28ab78478b615d/html5/thumbnails/6.jpg)
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: Practica 7 edhiel](https://reader037.fdocuments.mx/reader037/viewer/2022100803/58e859611a28ab78478b615d/html5/thumbnails/7.jpg)
•
• 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: Practica 7 edhiel](https://reader037.fdocuments.mx/reader037/viewer/2022100803/58e859611a28ab78478b615d/html5/thumbnails/8.jpg)
![Page 9: Practica 7 edhiel](https://reader037.fdocuments.mx/reader037/viewer/2022100803/58e859611a28ab78478b615d/html5/thumbnails/9.jpg)
Lo corremos..
![Page 10: Practica 7 edhiel](https://reader037.fdocuments.mx/reader037/viewer/2022100803/58e859611a28ab78478b615d/html5/thumbnails/10.jpg)
LISTO