Saturday, May 29, 2010

Airsoft Nightprowler Pieces

Calculator version almost DefInt

---------------- Calcolatrice.java ----------------

/*
* To change this template, choose Tools
import android.content.Intent;

/**

*

* @author 4ALE

*/
public class Calcolatrice extends Activity {

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView (R.layout.main)

/ / TODO add your GUI initialization code here


} ; public double leggiV1 () {EditText
number1 = (EditText) findViewById (R.id.num1) ;
double num1=0;
        try{

                    num1=Double.parseDouble(numero1.getText().toString());

                    } Catch (Exception e) {
& # 160; numero1.setError ("Your entry is invalid");
& # 160;
} return num1;}

& # 160; public double leggiV2 () {
numero2 edit text = (text edit ) findViewById (R.id.num2)
double num2 = 0;
& # 160; try{
                    num2=Double.parseDouble(numero2.getText().toString());
                    }catch(Exception e) {
& # 160; numero2.setError ( "Your entry is invalid");
& # 160;
} return num2;}

& # 160; public void add (View view) {
; leggiV1 double a = ();
& # 160; leggiV2 double b = ();
; double c = a + b;
setRisp ( a b +"+"+ +"="+ c);}


public void cos (View view) {double num1 =
leggiV1 ();
double Math.toRadians = (num1);
double cos = Math.cos (a);
setRisp ("cos" + cos +"="+ num1);
;} public void
sen (View view) {
& # 160; leggiV1 double num1 = ();
double Math.toRadians = (num1);
& # 160; double sin = Math.sin (a);
& # 160; setRisp ("sin" sin +"="+ + num1);}

& # 160; public void setRisp (String risp) {
TextView ris1=(TextView)findViewById(R.id.ris);
        ris1.setText(risp);
    }

    public void diff(View view){
        double a=leggiV1();
        double b=leggiV2();
        double c = ab;
setRisp (a +"-"+ b + "=" , + c);}

public void by (View view) {
& # 160; leggiV1 double a = ();
; leggiV2 double b = ();
double c = a * b;
setRisp (a + "x" + b + "= "+ c);}

public void two (View view) {
double a = leggiV1 ();
& # 160; leggiV2 double b = ();
double c = a / b;
setRisp (a +"/"+ b + " = "+ c);}

public void tan (View view) {
; leggiV1 double a = ();
& # 160; double tan = Math.tan (Math.toRadians (a));
setRisp ("tan" + a tan +"="+);
;}
public void log (View view) {
& # 160; leggiV1 double a = ();
double l = Math . log (a);
setRisp ("log" + a +"="+ l);}

}

-------------- -
main.xml
----------------

\u0026lt;? xml version = "1.0" encoding = "UTF-8">
\u0026lt; table layout xmlns: android = "
http://schemas.android.com/apk/res/android"

android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: stretch columns = " 5 "

>

\u0026lt;TableRow> \u0026lt; ; TextView android: text = "numero" & # 160; android: layout_width = "100px"

& # 160; />

\u0026lt;
EditText android: layout_width = "200px" android : layout_height = "wrap_content" & # 160; android: id = "@ + id/num1"
/>
\u0026lt;/ TableRow>
\u0026lt;TableRow> ;
\u0026lt;TextView android: text = "numero"
& # 160; android: layout_width = "100px"
& # 160; />
\u0026lt;EditText
; android: layout_width = "200px"
android: layout_height = "wrap_content"
android: id = "@ + id/num2"
/>
\u0026lt;/ TableRow>
\u0026lt;TableRow>
\u0026lt;TextView android: text = "risultato:"
& # 160; android: layout_width = "100px"
, /> &
# 160; \u0026lt;TextView
android: layout_width = "200px"
android: layout_height = "30px"
& # 160; android: id = "@ + id / ris
/>
\u0026lt;/ TableRow>

\u0026lt;table layout xmlns: android = "
http://schemas.android.com/apk/res/android"

android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: stretch columns = "4"
>
\u0026lt;TableRow>
\u0026lt;Button android: id = "@ + id / somma"
& # 160; android: layout_width = "50px"
& # 160; android: layout_height = "50px"

; android: text = "+"

android: onClick = "somma" & # 160; /> \u0026lt;Button android: id = "@ + id / diff"
& # 160; android: layout_width = "50px"
& # 160; android: layout_height = "50px"
; android: text = "-"
android: onClick = "diff"
& # 160; />
\u0026lt;Button android: id = "@ + id / prodotto "
& # 160; android: layout_width = "50px"
& # 160; android: layout_height = "50px"
& # 160; android: text = "x"
, & # 160; android: onClick = "per"
/> &
# 160; \u0026lt;Button android: id = "@ + id / rapporto"
; android: layout_width = " ; 50px "
& # 160; android: layout_height = "50px"
& # 160; android: text = "" &
# 160; android: onClick = "divi"
& # 160; />
\u0026lt;/ TableRow>
\u0026lt;TableRow>
& # 160; \u0026lt;Button android: id = "@ + id / cos"
; android: layout_width = "70px"
& # 160; android: layout_height = "50px"
& # 160; android: text = "cos (x)"
& # 160; android: onClick = "cos"
/> &
# 160; \u0026lt;Button android: id = "@ + id / sin"
, & # 160; android: layout_width = "70px"
& # 160; android: layout_height = "50px"
& # 160; android: text = "sin (x)"
, & # 160; android: onClick = "sen"
/> &
# 160; \u0026lt;Button android: id = "@ + id / tan"
, & # 160; android: layout_width = "70px"
& # 160; android: layout_height = "50px"
& # 160; android: text = "tan (x)"
, & # 160; android: onClick = "tan"
/> &
# 160; \u0026lt;Button android: id = "@ + id / log"
; android: layout_width = " ; 70px "
& # 160; android: layout_height = "50px"
& # 160; android: text = "log (x)" # &
160; android: onClick = "log"
/>
\u0026lt;/ TableRow>
\u0026lt;/ table layout>
\u0026lt;/ table layout>











Senza titolo

0 comments:

Post a Comment