12345678910111213141516171819202122232425262728293031323334353637
  1. import java.text.DecimalFormat;
  2. public class CurrencyConverter {
  3. static final Double USDOLLAREXR = 1.00;
  4. static final Double EUROEXR = 0.94;
  5. static final Double BRITPOUNDEXR = 0.82;
  6. static final Double INDIARUPEEEXR = 68.32;
  7. static final Double AUSTDOLLAREXR = 1.35;
  8. static final Double CANADADOLLAREXR = 1.32;
  9. static final Double SINGDOLLAREXR = 1.43;
  10. static final Double SWISSFRANCEXR = 1.01;
  11. static final Double MALAYSRINGGITEXR = 4.47;
  12. static final Double JAPANYENEXR = 115.84;
  13. static final Double CHINAYUANEXR = 6.92;
  14. private Double currentC;
  15. private Double convertedC;
  16. private Double currentA;
  17. public CurrencyConverter(Double currentC, Double convertedC, Double currentA){
  18. this.currentC = currentC;
  19. this.convertedC = convertedC;
  20. this.currentA = currentA;
  21. }
  22. public static Double convertCurrency(Double currentA, Double currentC, Double convertedC){
  23. Double convertedA = (currentA * convertedC) / currentC;
  24. convertedA = convertedA * 100;
  25. long temp = Math.round(convertedA);
  26. return (double) temp / 100;
  27. }
  28. }