Calculadora Gigante Básica

Calculadora Gigante Básica Free App

Rated 3.00/5 (5) —  Free Android application by Eduardo D'Avila

Advertisements

About Calculadora Gigante Básica

Prof. Eduardo D'Avila
Material de aula da disciplina Android Mobile e Java POO
Curso Técnico Pronatec Estácio de Sá / Campus WestShopping Campo Grande RJ

/**
* Created by Eduardo on 26/06/2015.
*/
public class Calculadora {
public double operando;
private double operandoAnterior;
private String operadorAnterior = "";


public void realizarOperacao(String operadorAtual) {
realizarOperacaoAnterior();
operandoAnterior = operando;
operadorAnterior = operadorAtual;
}

public void realizarOperacaoAnterior() {
if (!operadorAnterior.equals("")) {
if (operadorAnterior.equals("+")) {
operando = operandoAnterior + operando;
} else if (operadorAnterior.equals("-")) {
operando = operandoAnterior - operando;
} else if (operadorAnterior.equals("÷")) {
if (operando != 0)
operando = operandoAnterior / operando;
} else if (operadorAnterior.equals("*")) {
operando = operandoAnterior * operando;
}
}
}


}


----------------------------------------------------------------------------------------------------------------------------------------


import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;


public class MainActivity extends Activity {
Typeface fonteDigital;
TextView txtVisor;
// Button bt0, bt1, bt2, bt3, bt4, bt5, bt6, bt7, bt8, bt9;
// int nbt0 = 0, nbt1 = 1, nbt2 = 2, nbt3 = 3, nbt4 = 4, nbt5 = 5, nbt6 = 6, nbt7 = 7, nbt8 = 8, nbt9 = 9;
boolean digitandoNovoNumero = true;
Button botaoTocado;
Calculadora calc = new Calculadora();


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txtVisor = (TextView) findViewById(R.id.txtVisor);
fonteDigital = Typeface.createFromAsset(getAssets(), "digital.ttf");
txtVisor.setTypeface(fonteDigital);


}


public void digitarNumero(View view) {
botaoTocado = (Button) view;
if (digitandoNovoNumero) {
txtVisor.setText(botaoTocado.getText());
digitandoNovoNumero = false;
} else {
txtVisor.setText(txtVisor.getText() + botaoTocado.getText().toString());
}

}


public void digitarOperacao(View view) {
botaoTocado = (Button) view;
double operandoVisor = Double.parseDouble(txtVisor.getText().toString());
calc.operando = operandoVisor;
calc.realizarOperacao(botaoTocado.getText().toString());
txtVisor.setText(String.valueOf(calc.operando));

digitandoNovoNumero = true;

}


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

@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();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}
}

-------------------------------------------------------------

Prof. Eduardo D'Avila
Class material of discipline Android Mobile and Java OOP
Course Pronatec Technical Estacio de Sa / Campus WestShopping Campo Grande RJ

/ **
 * Created by Eduardo on 26/06/2015.
 * /
public class Calculator {
    public double operating;
    private double operandoAnterior;
    private String operadorAnterior = "";


    public void realizarOperacao (String operadorAtual) {
        realizarOperacaoAnterior ();
        operandoAnterior = operating;
        operadorAnterior = operadorAtual;
    }

    public void realizarOperacaoAnterior () {
        if (! operadorAnterior.equals ("")) {
            if (operadorAnterior.equals ("+")) {
                operating operandoAnterior = + operating;
            } Else if (operadorAnterior.equals ("-")) {
                = operating operandoAnterior - operating;
            } Else if (operadorAnterior.equals ("÷")) {
                if (operating! = 0)
                    = operating operandoAnterior / operating;
            } Else if (operadorAnterior.equals ("*")) {
                * = operating operandoAnterior operating;
            }
        }
    }


}


----------------------------------------------------------------------------------------------------------------------------------------


import android.app.Activity;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;


public class MainActivity extends Activity {
    Typeface fonteDigital;
    TextView txtVisor;
    // Button BT0, bt1, bt2, bt3, BT4, BT5, BT6, BT7, BT8, BT9;
    // Int nbt0 = 0, nbt1 = 1, = 2 nbt2, nbt3 = 3, nbt4 = 4, nbt5 = 5, nbt6 = 6, nbt7 = 7, nbt8 = 8, nbt9 = 9;
    digitandoNovoNumero boolean = true;
    Button botaoTocado;
    Calculator calc = new Calculator ();


    Override
    protected void onCreate (Bundle savedInstanceState) {
        super.onCreate (savedInstanceState);
        setContentView (R.layout.activity_main);
        txtVisor = (TextView) findViewById (R.id.txtVisor);
        fonteDigital = Typeface.createFromAsset (getAssets () "digital.ttf");
        txtVisor.setTypeface (fonteDigital);


    }


    public void digitarNumero (View view) {
        botaoTocado = (Button) view;
        if (digitandoNovoNumero) {
            txtVisor.setText (botaoTocado.getText ());
            digitandoNovoNumero = false;
        } Else {
            txtVisor.setText (txtVisor.getText () + botaoTocado.getText (). toString ());
        }

    }


    public void digitarOperacao (View view) {
        botaoTocado = (Button) view;
        double operandoVisor = Double.parseDouble (txtVisor.getText (). toString ());
        calc.operando = operandoVisor;
        calc.realizarOperacao (botaoTocado.getText (). toString ());
        txtVisor.setText (String.valueOf (calc.operando));

        digitandoNovoNumero = true;

    }


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

    Override
    public boolean onOptionsItemSelected (MenuItem item) {
        // Handle action bar item clicks here. The action will bar
        // Handle automatically clicks on the Home / Up button, so long
        // As you specify the parent activity in AndroidManifest.xml.
        int id = item.getItemId ();

        // Noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected (item);
    }
}
  

-------------------------------------------------- -----------

Application Screenshots

Screenshot #1: Calculadora Gigante Básica for Android
Screenshot #2: Calculadora Gigante Básica for Android

Never Miss An Update!

Follow Android Blip on Facebook / Google+


Download / Install

Download and install Calculadora Gigante Básica version 2 on your Android device!
Downloaded 500+ times, content rating: Everyone
Android package: novatecquerino2.eduardodavila.app.novatecquerino2, download Calculadora Gigante Básica.apk

All Application Badges

Free
downl.
Android
4.0.3+
For everyone
Android app

App History & Updates

What's Changed
Correção de Erros.
*Ajuste do visor numérico.
*Settings removido, para estabilidade do App.
*Desativado a orientação horizontal.
*Somente orientação vertical, Smartphone e Tablet.
More downloads  Calculadora Gigante Básica reached 500 - 1 000 downloads

Share The Word!


Rating Distribution

RATING
3.05
5 users

5

4

3

2

1