diff --git a/pom.xml b/pom.xml
index 682d6db..38a32ed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,6 +9,11 @@
1.0-SNAPSHOT
-
+
+ junit
+ junit
+ 4.12
+ test
+
\ No newline at end of file
diff --git a/src/main/java/CurrencyConverter.java b/src/main/java/CurrencyConverter.java
new file mode 100644
index 0000000..0bedb22
--- /dev/null
+++ b/src/main/java/CurrencyConverter.java
@@ -0,0 +1,28 @@
+import java.util.Map;
+import java.util.TreeMap;
+
+public class CurrencyConverter {
+
+ private double convertingCurrency;
+
+ private Map conversionMap = new TreeMap() {
+ {
+ put("Us Dollar", 1.00);
+ put("Euro", 0.94);
+ put("British Pound", 0.82);
+ put("Indian Rupee", 68.32);
+ put("Australian Dollar", 1.35);
+ put("Canadian Dollar", 1.32);
+ put("Singapore Dollar", 1.43);
+ put("Swiss Franc", 1.01);
+ put("Malaysian Ringgit", 4.47);
+ put("Japanese Yen", 115.84);
+ put("Chinese Yuan Renminbi", 6.92);
+ }
+ };
+ public double convertCurrentToDestinationCurrency(String current, String destination, double fatStack) {
+ convertingCurrency = ((conversionMap.get(destination)) / (conversionMap.get(current))) * fatStack;
+ return convertingCurrency;
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/DELETEME b/src/main/java/DELETEME
deleted file mode 100644
index e69de29..0000000
diff --git a/src/test/java/CurrencyConverterTest.java b/src/test/java/CurrencyConverterTest.java
new file mode 100644
index 0000000..61884ee
--- /dev/null
+++ b/src/test/java/CurrencyConverterTest.java
@@ -0,0 +1,104 @@
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import java.util.TreeMap;
+
+
+
+public class CurrencyConverterTest {
+
+ CurrencyConverter converter;
+
+ @Before
+ public void Setup() {
+ converter = new CurrencyConverter();
+ }
+
+
+ @Test
+ public void testDollarToEuro() {
+ double expected = 1128.00;
+ double actual = converter.convertCurrentToDestinationCurrency(
+ "Us Dollar", "Euro", 1200);
+ Assert.assertEquals(expected, actual,.01 );
+ }
+
+ @Test
+ public void testEuroToDollar() {
+ double expected = 2180.85;
+ double actual = converter.convertCurrentToDestinationCurrency(
+ "Euro", "Us Dollar", 2050);
+ Assert.assertEquals(expected, actual,.01 );
+ }
+
+
+ @Test
+ public void testEuroToBritishPound() {
+ double expected = 283.51;
+ double actual = converter.convertCurrentToDestinationCurrency(
+ "Euro", "British Pound", 325);
+ Assert.assertEquals(expected, actual,.01 );
+ }
+
+
+ @Test
+ public void testBritishPoundToIndianRupee() {
+ double expected = 185797.07;
+ double actual = converter.convertCurrentToDestinationCurrency(
+ "British Pound", "Indian Rupee", 2230);
+ Assert.assertEquals(expected, actual,.01 );
+ }
+
+
+ @Test
+ public void testRupeeToCanadianDollar() {
+ double expected = 96.60;
+ double actual = converter.convertCurrentToDestinationCurrency(
+ "Indian Rupee", "Canadian Dollar", 5000);
+ Assert.assertEquals(expected, actual,.01 );
+ }
+
+
+ @Test
+ public void testCanadianDollarToSingaporeDollar() {
+ double expected = 59.58;
+ double actual = converter.convertCurrentToDestinationCurrency(
+ "Canadian Dollar", "Singapore Dollar", 55);
+ Assert.assertEquals(expected, actual,.01 );
+ }
+
+
+ @Test
+ public void testSingaporeDollarToSwissFranc() {
+ double expected = 234.49;
+ double actual = converter.convertCurrentToDestinationCurrency(
+ "Singapore Dollar", "Swiss Franc", 332);
+ Assert.assertEquals(expected, actual,.01 );
+ }
+
+
+ @Test
+ public void testSwissFrancToMalaysianRinggit() {
+ double expected = 5421.53;
+ double actual = converter.convertCurrentToDestinationCurrency(
+ "Swiss Franc", "Malaysian Ringgit", 1225);
+ Assert.assertEquals(expected, actual, .01);
+ }
+
+
+ @Test
+ public void testMalaysianRinggitToJapaneseYen() {
+ double expected = 8292.79;
+ double actual = converter.convertCurrentToDestinationCurrency(
+ "Malaysian Ringgit", "Japanese Yen", 320);
+ Assert.assertEquals(expected, actual,.01 );
+ }
+
+ @Test
+ public void testJapaneseYenToChineseYuanRenminbi() {
+ double expected = 7320.84;
+ double actual = converter.convertCurrentToDestinationCurrency(
+ "Japanese Yen", "Chinese Yuan Renminbi", 122550);
+ Assert.assertEquals(expected, actual,.01 );
+ }
+}
\ No newline at end of file
diff --git a/src/test/java/DELETEME b/src/test/java/DELETEME
deleted file mode 100644
index e69de29..0000000
diff --git a/target/classes/CurrencyConverter$1.class b/target/classes/CurrencyConverter$1.class
new file mode 100644
index 0000000..d79ac2e
Binary files /dev/null and b/target/classes/CurrencyConverter$1.class differ
diff --git a/target/classes/CurrencyConverter.class b/target/classes/CurrencyConverter.class
new file mode 100644
index 0000000..bd0dea9
Binary files /dev/null and b/target/classes/CurrencyConverter.class differ
diff --git a/target/test-classes/CurrencyConverterTest.class b/target/test-classes/CurrencyConverterTest.class
new file mode 100644
index 0000000..cbd2b69
Binary files /dev/null and b/target/test-classes/CurrencyConverterTest.class differ