Date post: | 12-Aug-2015 |
Category: |
Education |
Upload: | amairanyrojas |
View: | 38 times |
Download: | 0 times |
ROJAS JUAREZ MARIELY AMAIRANY
4 AM
PROGRAMACIÓN
PROFESORA: MARGARITA ROMERO ALVARADO
DESARROLLA APLICACIONES MOVILES
20 PROGRAMAS EN JAVA ECLIPSE
1.-EL AREA DE UN CIRCULO
Package com.example.areadeuncircuo;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.main, menu); return true;
}
Public void calcular (View view) {
EditText et1=(EditText) findViewById (R.id.num1);TextView sol=(TextView) findViewById (R.id.res);
doublen1= Double. parseDouble(et1.getText().toString());
double r;
r= 3.1416*(n1*ni);
sol.setText(String.valueOf(“El area del circulo es igual a “+r));
}
}
2.-YARDAS A CENTIMETROS
Package com.example.yardasacm;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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));
}
}
3.-MILLAS A PIES
Package com.example.millasapies;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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*5280;
sol.setText(String.valueOf(“El resultado de “+n1+”=”+r));
}
}
4.-METROS A CENTIMETROS
Package com.example.metrosayardas;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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.valueOf(“El resultado de “+n1+”=”+r));
}
}
5.-METROS A MILIMETROS
Package com.example.metrosamm;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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));
}
}
6.-METROS A PULGADAS
Package com.example.mtrosapulgadas;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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));
}
}
7.-METROS A PIES
Package com.example.metrosapies;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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*3.28;
sol.setText(String.valueOf(“El resultado de “+n1+”=”+r));
}
}
8.-METROS A YARDAS
Package com.example.metrosayardas;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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*3.28;
sol.setText(String.valueOf(“El resultado de “+n1+”=”+r));
}
}
9.-HORAS A MINUTOS
Package com.example.hrsamin;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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 “+n1+”=”+r));
}
}
10.-TONELADAS A KILOGRAMOS
Package com.example.tonakg;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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));
}
}
11.- KILOGRAMOS A GRAMOS
Package com.example.kgag;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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));
}
}
12.-PULGADAS A METROS
Package com.example.pulgadasamts;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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*.254;
sol.setText(String.valueOf(“El resultado de “+n1+”=”+r));
}
}
13.-PIES A MILLAS
Package com.example.piesamillas;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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*.0001893939;
sol.setText(String.valueOf(“El resultado de “+n1+”=”+r));
}
}
14.-PIES A METROS
Package com.example.piesamts;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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*.3048;
sol.setText(String.valueOf(“El resultado de “+n1+”=”+r));
}
}
15.-PIES A CENTIMETROS
Package com.example.piesacm;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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*30.48;
sol.setText(String.valueOf(“El resultado de “+n1+”=”+r));
}
}
16.-LIBRAS A KILOS
Package com.example.librasakilos;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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*.45359237;
sol.setText(String.valueOf(“El resultado de “+n1+”=”+r));
}
}
17.- SUSTRACCION DE 3 NUMEROS
Package com.example.sustraccionde3muns;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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);doubledouble n1= Double. parseDouble(num1.getText().toString());
doubledouble n2= Double. parseDouble(num2.getText().toString());
doubledouble n3= Double. parseDouble(num3.getText().toString());
double r;r= n1-n2-n3;sol.setText(String.valueOf(“El resultado de “+n1-“+n2+”-“+n3+”=”r));
} }
18.-METROS CUBICOS A LITROS
Package com.examplemtscubicosalts;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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));
}
}
19.-CENTIMETROS CUBICOS A MILILITROS
Package com.example.cmcubicosamililitros;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.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*1;
sol.setText(String.valueOf(“El resultado de “+n1+”=”+r));
}
}
20.-LA SUMA DE DOS NUMEROS ELEVADOS AL CUADRADO
Package com.example.lasumadedosnumselevadosalcuadrado;
Import android.os.Bundle;Import android.os.app.Activity;Import android.os.view.Menu;Import android.os.view.View;Import android.os.widget.EditText;Import android.os.widget.TextView;
Public class MainActivity extends Activity {
@OverrideProtected void onCreate(Bundle savedInstanceState) Super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
}
@Override Public Boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds to the action bar if it is present. getMenuInflater().inflate(R.manu.main, menu); return true;
}
Public void calcular (View view) {
EditText num1=(EditText) findViewById (R.id.et1);EditText num2=(EditText) findViewById (R.id.et2);TextView sol=(TextView) findViewById (R.id.res);
doubledouble n1= Double. parseDouble(num1.getText().toString());
doubledouble n2= Double. parseDouble(num2.getText().toString());
double r;
r= (n1+*n1)+(N2*N2);
sol.setText(String.valueOf(“El resultado de “+n1+“+n2+”=”+r));
}
}