Advertisement
brilliant_moves

ForeignCurrencyConverter.java

Sep 4th, 2020
2,437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 1.04 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ForeignCurrencyConverter {
  4.  
  5.     public double ECD2USDollar (double ecd) {
  6.         return ecd * 0.37;
  7.     }
  8.  
  9.     public double DP2USDollar (double dp) {
  10.         return dp * 0.019;
  11.     }
  12.  
  13.     public double BR2USDollar (double br) {
  14.         return br * 0.239;
  15.     }
  16.  
  17.     public static void main (String[] args) {
  18.         ForeignCurrencyConverter converter = new ForeignCurrencyConverter();
  19.         Scanner in = new Scanner (System.in);
  20.         double usd = 0.0;
  21.         double input;
  22.  
  23.         System.out.print ("Enter number of Eastern Caribbean Dollars :");
  24.         input = in.nextDouble();
  25.         usd += converter.ECD2USDollar (input);
  26.  
  27.         System.out.print ("Enter number of Dominican Pesos :");
  28.         input = in.nextDouble();
  29.         usd += converter.DP2USDollar (input);
  30.  
  31.         System.out.print ("Enter number of Brazilian Reals :");
  32.         input = in.nextDouble();
  33.         usd += converter.BR2USDollar (input);
  34.  
  35.         System.out.printf ("US Dollars = $%.2f\n", usd);
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement