Calculadora Gigante icône

2 by EduDavila´s DevApp


Oct 8, 2015

À propos de Calculadora Gigante

Français

Exemple Calculator App utilisé en classe Pronatec Estacio de Sa

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

}

}

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

Quoi de neuf dans la dernière version 2

Last updated on Oct 8, 2015

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.

Chargement de la traduction...

Informations Application supplémentaires

Dernière version

Demande Calculadora Gigante mise à jour 2

Telechargé par

Eduardo Salazar

Nécessite Android

Android 4.0.3+

Voir plus

Calculadora Gigante Captures d'écran

Charegement du commentaire...
Langues
Langues
Recherche en cours...
Abonnez-vous à APKPure
Soyez le premier à avoir accès à la sortie précoce, aux nouvelles et aux guides des meilleurs jeux et applications Android.
Non merci
S'inscrire
Abonné avec succès!
Vous êtes maintenant souscrit à APKPure.
Abonnez-vous à APKPure
Soyez le premier à avoir accès à la sortie précoce, aux nouvelles et aux guides des meilleurs jeux et applications Android.
Non merci
S'inscrire
Succès!
Vous êtes maintenant souscrit à notre newsletter.