Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. package ntc.com;
  2.  
  3. import androidx.appcompat.app.AppCompatActivity;
  4.  
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.widget.EditText;
  8. import android.widget.TextView;
  9.  
  10. public class MainActivity extends AppCompatActivity {
  11.  
  12. EditText ETPhp;
  13. TextView TVresultsCdd,
  14. TVresultsSgd,
  15. TVresultsGbp,
  16. TVresultsChy,
  17. TVresultsTry,
  18. TVresultsRol,
  19. TVresultsKrw,
  20. TVresultsJpy,
  21. TVresultsEur,
  22. TVresultsRub;
  23.  
  24. Double db_peso = 0.0,
  25. db_cdollar = 0.0,
  26. db_sgd = 0.0,
  27. db_gbp = 0.0,
  28. db_chy = 0.0,
  29. db_try = 0.0,
  30. db_rol = 0.0,
  31. db_krw = 0.0,
  32. db_jpy = 0.0,
  33. db_eur = 0.0,
  34. db_rub = 0.0;
  35.  
  36.  
  37. @Override
  38. protected void onCreate(Bundle savedInstanceState) {
  39. super.onCreate(savedInstanceState);
  40. setContentView(R.layout.activity_main);
  41.  
  42. ETPhp=(EditText)findViewById(R.id.ETPhp);
  43. TVresultsCdd=(TextView)findViewById(R.id.TVresultsCdd);
  44. TVresultsSgd=(TextView)findViewById(R.id.TVresultsSgd);
  45. TVresultsGbp=(TextView)findViewById(R.id.TVresultsGbp);
  46. TVresultsChy=(TextView)findViewById(R.id.TVresultsChy);
  47. TVresultsTry=(TextView)findViewById(R.id.TVresultsTry);
  48. TVresultsRol=(TextView)findViewById(R.id.TVresultsRol);
  49. TVresultsKrw=(TextView)findViewById(R.id.TVresultsKrw);
  50. TVresultsJpy=(TextView)findViewById(R.id.TVresultsJpy);
  51. TVresultsEur=(TextView)findViewById(R.id.TVresultsEur);
  52. TVresultsRub=(TextView)findViewById(R.id.TVresultsRub);
  53. }
  54.  
  55. public void convert (View view){
  56.  
  57. db_peso = Double.parseDouble(ETPhp.getText().toString());
  58. db_cdollar = db_peso * 0.02616;
  59. db_sgd = db_peso * 0.0274737;
  60. db_gbp = db_peso * 0.0151314;
  61. db_chy = db_peso * 0.138185;
  62. db_try = db_peso * 0.119775;
  63. db_rol = db_peso * 0.0872507;
  64. db_krw = db_peso * 23.5026;
  65. db_jpy = db_peso * 2.16561;
  66. db_eur = db_peso * 0.0182464;
  67. db_rub = db_peso * 1.25980;
  68.  
  69.  
  70.  
  71. TVresultsCdd.setText(String.valueOf(db_cdollar)+" CAD");
  72. TVresultsSgd.setText(String.valueOf(db_sgd)+" SGD");
  73. TVresultsGbp.setText(String.valueOf(db_gbp)+" GBP");
  74. TVresultsChy.setText(String.valueOf(db_chy)+" CHY");
  75. TVresultsTry.setText(String.valueOf(db_try)+" TRY");
  76. TVresultsRol.setText(String.valueOf(db_rol)+" ROL");
  77. TVresultsKrw.setText(String.valueOf(db_krw)+" KRW");
  78. TVresultsJpy.setText(String.valueOf(db_gbp)+" JPY");
  79. TVresultsEur.setText(String.valueOf(db_eur)+" EUR");
  80. TVresultsRub.setText(String.valueOf(db_rub)+" RUB");
  81.  
  82. }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement