Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void somar (View v){
- EditText odd1 = (EditText) findViewById(R.id.editText7);
- String stringodd1 = odd1.getText().toString();
- EditText odd2 = (EditText) findViewById(R.id.editText8);
- String stringodd2 = odd2.getText().toString();
- EditText odd3 = (EditText) findViewById(R.id.editText9);
- String stringodd3 = odd3.getText().toString();
- EditText montante = (EditText) findViewById(R.id.editText12);
- String stringmontante = montante.getText().toString();
- if (stringodd1.trim().isEmpty() || stringodd2.trim().isEmpty() || stringodd3.trim().isEmpty())
- {
- Toast.makeText(getApplicationContext(), "Campos em branco",
- Toast.LENGTH_LONG).show();
- }
- else
- {
- double valorodd1 = Double.parseDouble(stringodd1);
- double valorodd2 = Double.parseDouble(stringodd2);
- double valorodd3 = Double.parseDouble(stringodd2);
- double valormontante = Double.parseDouble(stringmontante);
- double resu = valorodd1 * valorodd2 * valorodd3 * valormontante;
- TextView resultado = (TextView) findViewById(R.id.textView15);
- resultado.setText (resu + "€" );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement