Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ntc.com;
- import androidx.appcompat.app.AppCompatActivity;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.EditText;
- import android.widget.TextView;
- public class MainActivity extends AppCompatActivity {
- EditText ETPhp;
- TextView TVresultsCdd,
- TVresultsSgd,
- TVresultsGbp,
- TVresultsChy,
- TVresultsTry,
- TVresultsRol,
- TVresultsKrw,
- TVresultsJpy,
- TVresultsEur,
- TVresultsRub;
- Double db_peso = 0.0,
- db_cdollar = 0.0,
- db_sgd = 0.0,
- db_gbp = 0.0,
- db_chy = 0.0,
- db_try = 0.0,
- db_rol = 0.0,
- db_krw = 0.0,
- db_jpy = 0.0,
- db_eur = 0.0,
- db_rub = 0.0;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- ETPhp=(EditText)findViewById(R.id.ETPhp);
- TVresultsCdd=(TextView)findViewById(R.id.TVresultsCdd);
- TVresultsSgd=(TextView)findViewById(R.id.TVresultsSgd);
- TVresultsGbp=(TextView)findViewById(R.id.TVresultsGbp);
- TVresultsChy=(TextView)findViewById(R.id.TVresultsChy);
- TVresultsTry=(TextView)findViewById(R.id.TVresultsTry);
- TVresultsRol=(TextView)findViewById(R.id.TVresultsRol);
- TVresultsKrw=(TextView)findViewById(R.id.TVresultsKrw);
- TVresultsJpy=(TextView)findViewById(R.id.TVresultsJpy);
- TVresultsEur=(TextView)findViewById(R.id.TVresultsEur);
- TVresultsRub=(TextView)findViewById(R.id.TVresultsRub);
- }
- public void convert (View view){
- db_peso = Double.parseDouble(ETPhp.getText().toString());
- db_cdollar = db_peso * 0.02616;
- db_sgd = db_peso * 0.0274737;
- db_gbp = db_peso * 0.0151314;
- db_chy = db_peso * 0.138185;
- db_try = db_peso * 0.119775;
- db_rol = db_peso * 0.0872507;
- db_krw = db_peso * 23.5026;
- db_jpy = db_peso * 2.16561;
- db_eur = db_peso * 0.0182464;
- db_rub = db_peso * 1.25980;
- TVresultsCdd.setText(String.valueOf(db_cdollar)+" CAD");
- TVresultsSgd.setText(String.valueOf(db_sgd)+" SGD");
- TVresultsGbp.setText(String.valueOf(db_gbp)+" GBP");
- TVresultsChy.setText(String.valueOf(db_chy)+" CHY");
- TVresultsTry.setText(String.valueOf(db_try)+" TRY");
- TVresultsRol.setText(String.valueOf(db_rol)+" ROL");
- TVresultsKrw.setText(String.valueOf(db_krw)+" KRW");
- TVresultsJpy.setText(String.valueOf(db_gbp)+" JPY");
- TVresultsEur.setText(String.valueOf(db_eur)+" EUR");
- TVresultsRub.setText(String.valueOf(db_rub)+" RUB");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement