Programa 7

16
Centro de Estudio Tecnológicos Industrial & Servicios 109. Nombre: ADRIANA LIZBETH AVILA ORTIZ. MARICARMEN AVILA ORTIZ GRADO & GRUPO: 4° “BM” PROFESORA: MARGARITA ROMERO ALVARADO. MATERIA:DESARROLLAR APLICACIONES MOVIL. AULA:31 CICLO ESCOLAR: FEB-JUN 2015.

Transcript of Programa 7

Page 1: Programa 7

Centro de Estudio Tecnológicos Industrial & Servicios 109.Nombre: ADRIANA LIZBETH AVILA ORTIZ. MARICARMEN AVILA ORTIZGRADO & GRUPO: 4° “BM”PROFESORA: MARGARITA ROMERO ALVARADO.MATERIA:DESARROLLAR APLICACIONES MOVIL.AULA:31CICLO ESCOLAR: FEB-JUN 2015.

Page 2: Programa 7

PASO 1 HABRE EL PROGRAMA.

Page 3: Programa 7

PASO 2

Page 4: Programa 7

PASO 3 DAR CLIC EN NEW Y ANDROID APLICATION PROJECT.

Page 5: Programa 7

PASO 4 PONER NOMBRE DEL PROJECTO Y DAR CLIC FINISH.

Page 6: Programa 7

PASO 5 DAR CLIC EN NEXT Y EN LA ULTAMA TABLA DAR CLIC EN FINISH.

Page 7: Programa 7

PASO 6 ELIMINAR HOLA MUNDO Y ARASTRAR UN Medium ASIA LA PANTALLA PONIENDO EN TEXT:Dame un numero.

Page 8: Programa 7

Paso7 poner un abc y eliminar el text y Hint:Numero

Page 9: Programa 7

PASO 8 ATRASTRAR ASI LA PANTALLA BOTTON Y PONIENDO EN TEXT:Calcular y en onclick:calcular

Page 10: Programa 7

Paso 10 Arastrar un mediumasi la pantalla y en text:Como podemos observar toma una decision equivocada,debido a la estructura del if, pero este error se corregra en el siguiente

ejercicio en donde se utiliza el if else

Page 11: Programa 7

PASO 11 ARASTRA A LA PANTALLA UN Medium Y PONIENDOLE EN Hint:Resultado y cambiar el id:@+id/res.

Page 12: Programa 7

PASO 12 DAR CLIC EN Scr, DAR CLIC EN DAR CLIC EN MainActivity.java LUEGO TE APARESERA UNA CODIFICACION TENDRAS QUE PONER LO QUE FALTE ACONTINUACION TE

DEJAREMOS LOS DATOS QUE FALTEN.

Page 13: Programa 7

CODIFICACION. package com.programa7;

import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; import android.widget.TextView;

public class MainActivity extends ActionBarActivity {

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

@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; }

}

Page 14: Programa 7

@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); }

public void calcular (View view){ EditText n=(EditText) findViewById (R.id.num1); TextView r=(TextView) findViewById (R.id.res);

double d=Double.parseDouble(n.getText().toString());

if(d<0){ r.setText("Negativo"); } r.setText("Positivo"); }

}

Page 15: Programa 7

Después lo correremos y aparecerá así, y probaremos que si es un numero positivo

Page 16: Programa 7

COMENTARIO PEROSNAL: Como podemos ver este

programa es muy fácil para hacer ya que nomas es de seguir todos los paso.