20 codigos
TRANSCRIPT
CETIS 109
MARGARITA ROMERO ALVARADO
ARIANNA LIZEETH ALVAREZ LÓPEZ
AULA: 27 PROGRAMACIÓN
20 CODIGOS
AREA DE UN CUADRADO
package com.example.Areadeuncuadrado;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
Public void multiplicar (View view){
EditText et1=(EditText) findViewById (R.id.et1);
EditText et2=(EditText) findViewById (R.id.et2);
TextView sol=(TextView) findViewById (R.id.res);
double nro1=Double.parseDouble(et1.getText().toString());
double nro2=Double.parseDouble(et2.getText().toString());
double r;
r=nro1*nro2;
sol.setText(String.valueOf(“El resultado de “+nro1+” * “+nro2+” = “+r));
}
AREA DE UN NONAGONO
package com.example.Areadeunnonagono;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
public void calcular (View view) {
EditText lado=(EditText) findViewById (R.id.et1);
EditText apotema=(EditText) findViewById (R.id.et2);
EditText res=(EditText) findViewById (R.id.res);
double lad=Double.parseDouble (lado.getText().toString());
double apotem=Double.parseDouble(apotema.getText().toString());
double area;
area=((9*lad)*apotem)/2;
res.setText(String.valueOf(area));
}
YARDAS A PIES
package com.example.Yardasapies;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
public void calcular (View view){
EditText et1=(EditText) findViewById (R.id.num1);
EditText resu=(EditText) findViewById (R.id.res);
double yardas=Double.parseDouble(et1.getText().toString());
double ft=yardas*3;
Resu.setText(String.valueOf(ft+”ft”));
}
RESTA DE 3 NUMEROS
package com.example.restade3numeros;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
public void restar (View view){
EditText et1=(EditText) findViewById (R.id.num1);
EditText et2=(EditText) findViewById (R.id.num2);
EditText et3=(EditText) findViewById (R.id.num3);
TextView et4=(TextView) findViewById (R.id.tv3);
double
n1=Double.parseDouble (et1.getText().toString());
double
n2=Double.parseDouble (et2.getText().toString());
double
n3=Double.parseDouble (et1.getText().toString());
double r;
r=n1-n2-n3;
et4.setText(String.valueOf(“El rsultado de “+n1+” – “+n2+” – “+n3+” = “+r));
}
}
AREA DE UN CIRCULO
package com.example.Areadeuncirculo;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
public void multiplicar (View view){
EditText et1=(EditText) findViewById (R.id.num1);
TextView sol=(TextView) findViewById (R.id.res);
double n1=Double.parseDouble(et1.getText().toString());
double r;
r=3.1416*(n1*n1);
sol.setText(String.valueOf(“El area de el circulo es igual a”+r));
}
}
VOLUMEN DE UNA PIRAMIDE
package com.example.Volumendeunapiramide;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
Public void calcular (View view){
EditText et1=(EditText) findViewById (R.id.editText1);
EditText et2=(EditText) findViewById (R.id.editText2);
EditText et3=(EditText) findViewById (R.id.editText3);
float nro1=Integer.parseInt(et1.getText().toString());
float nro2=Integer.parseInt(et2.getText().toString());
float res=nro1*nro2/3;
et3.setText(String.valueOf(res));
}
}
MINUTOS A SEGUNDOS
package com.example.Minutosasegundos;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
public void calcular (View view){
EditText num1=(EditText) findViewById (R.id.et1);
TextView sol=(TextView) findViewById (R.id.res);
double
n1=Double.parseDouble (num1.getText().toString());
double r;
r=n1*60;
sol.setText(String.valueOf (“El resultado de r+n1+” = “ +r));
}
HORA A SEGUNDOS
package com.example.Horaasegundos;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
Public void calcular (View view) {
EditText num1=(EditText) findViewById (R.id.et1);
TextView sol=(TextView) findViewById (R.id.res);
double
n1=Double.parseDouble (num1.getText().toString());
double r;
r=n1*3600;
sol.setText(String.valueOf(“El resultado de “+n1+” = “+r));
}
YARDAS A CM
package com.example.Yardasacm;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
Public void calcular (View view) {
EditText num1=(EditText) findViewById (R.id.et1);
TextView sol=(TextView) findViewById (R.id.res);
double
n1=Double parseDouble (num1.getText().toString());
double r;
r=n1*91.44;
sol.setText(String.valueOf (“El resultado de “n1+” = “+r));
}
MILLAS A PIES
package com.example.Millasapies;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
public void calcular (View view){
EditText num1=(EditText) findViewById (R.id.et1);
TextView sol=(TextView) findView (R.id.res);
double
N1=Double parseDouble (num1.getText().toString ());
double r;
r=n1*5280;
sol.setText(String.valueOf (“El resultado de”+n1+! = +r));
}
PERIMETRO DE UN NONAGONO
package com.example.Perimetrodeunnonagono;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
Public void calcular (View view){
EditText num1=(EditText) findViewById (R.id.et1);
TextView sol=(TextView) findViewById (R.id.res);
double
n1=Double.parseDouble(num1.getText().toString());
double r;
r=n1*9;
sol.setText (String.valueOf(“El resultado de “+n1+” = “+r));
}
METROS A CM
package com.example.Metrosacm;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
Public void calcular (View view) {
EditText num1=(EditText) findViewById (R.id.et1);
TextView sol=(TextView) findViewById (R.id.res);
Double
N1=Double parseDouble (num1.getText().toString());
Double r;
R=n1*100;
Sol.setText (String value Of(“El resultado de”+n1+” = “+r));
}
PERIMETRO DE UNHEXAGONO
package com.example.Perimetrodeunhexagono;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
Public void calcular (View view) {
EditText num1=(EditText) findViewById (R.id.et1);
TextView sol=(TextView) findViewById (R.id.res);
double
n1=Double.parseDouble (num1.getText().toString));
double r;
r=n1*6;
sol.setText(String.valueOf(“El resultado de”+n1+” = “+r));
PERIMETRO DE UN OCTAGONO
package com.example.Perimetrodeunoctagono;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
Public void calcular (View view){
EditText num1=(EditText) findViewById (R.id.et1);
TextView sol=(TextView) findViewById (R.id.res);
Double
N1=Double.parseDouble (num1.getText().toString));
Double r;
R=n1*8;
Sol.setText(String.valueOf(“El resultado de “+n1” = “+r ));
}
M A MM
package com.example.MAMM;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
Public void calcular (View view) {
EditText num1=(EditText) findViewById (R.id.et1);
TextView sol=(TextView) findViewById (R.id.res);
double
N1=Double.parseDouble (num1.getText() toString());
double r;
R=n1*1000;
Sol.setText (String.valueOf(“El resultado de “+n1+! = “+r));
}
M A PULGADAS
package com.example.Mapulgadas;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
public void calcular (View view){
EditText num1=(EditText) findViewById (R.id.et1);
TextView sol=(TextView) FindViewById (R.id.res);
double
n1=Double.parseDouble (num1.getText().toString());
double r;
r=n1*39.37;
sol.setText(String.valueOf(“El resultado de “+n1+” = “+r));
}
SUMA DE DOS NUMEROS ELEVADOS AL CUADRADO
package com.example.sumadedosnumeroselevadosalcuadrado;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
Public void calcular (View view) {
EditText num1=(EditText) findViewById (R.id.t1);
EditText num2=(EditText) findViewById (R.id.et2);
TextView sol=(TextView) findViewById (R.id.res);
Double
N1=Double.parseDouble(num1.getText().toString());
Double
N2=Double.parseDouble(num2.getText().toString());
Double r;
R=(n2*n1) + (n2*n2);
Sol.setText(String.valueOf(“El resultado de “ +n1+” + “+n2” = “
+r));
}
SUSTRACCION DE 3 NUMEROS
package com.example.Sustraccionde3numeros;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
Public void calcular (View view){
EditText num1=(EditText) findViewById (R.id.et1);
EditText num2=(EditText) findViewById (R.id.et2);
EditText num3=(EditText) findViewById (R.id.et3);
TextView sol(TextView) findViewById (R.id.res);
Double
N1=Double.parseDouble (num1.get().toString());
Double
N1=Double.parseDouble (num1.get().toString());
Double
N1=Double.parseDouble (num1.get().toString());
Double r;
R=n1-n2-n3;
Sol.setText(String.valueOf (“El resultado de “+n1”+n2+” – “+n3+” = “r));
}
M A PIES
package com.example.Mapies;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
Public void calcular (View view) {
EditText num1=(EditText) findViewById (R.id.et1);
TextView sol= (TextView) findViewById (R.id.res);
Double
N1=Double.parseDouble(num1.getText().toString());
Double r;
R=n1*328;
Sol.setText(String.valueOf(“El resultado de “+n2” = “+r));
}
HORA A MIN
package com.example.Horaamin;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
@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;
}
Public void calcular (View view) {
EditText num1=(EditText) findViewById (R.id.et1);
TextView sol=(TextView) findViewById (R.id.res);
Double
N1=Double parseDouble (num1getText() toString());
Double r;
R=n1*60;
Sol.setText (String.valueOf(“El resultado de “n1” = “+r));
}