Skip to content

the beginning of everything:) #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/main/java/(ConverterTest).java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

/*
*
* Created by amazing amy 2/16/18
*
* have a nice day
*
*
*/

/*

import org.junit.Before;

import org.junit.Test;


public class ConverterTest {

public static void main(String[] args) {

}



@Test

//last
}

*/
69 changes: 69 additions & 0 deletions src/main/java/CurrencyConverter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
*
* Created by amazing amy 2/16/18
*
* have a nice day
*
*
*
*/

public class CurrencyConverter {

private double getExchangeRate(testCurrencyEnum desiredXRate) {

//i am not yet sure if i need to use return or System.out.println(). I think it's the latter.
switch (desiredXRate) {
case USD:
System.out.println(1.00);
break;

case EUR:
return 0.94;
break;

case GBP:
return 0.82;
break;

case INR:
return 68.32;
break;

case AUD:
return 1.35;
break;

case CAD:
return 1.32;
break;

case SGD:
return 1.43;
break;

case CHF:
return 1.01;
break;

case MYR:
return 4.47;
break;

case JPY:
return 115.84;
break;

case CNY:
return 6.92;
break;

default:
return 0.00;

}

return 0.0;

}
}
3 changes: 3 additions & 0 deletions src/main/java/TestCurrencyEnum.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public enum TestCurrencyEnum
{USD, EUR, GBP, INR, AUD, CAD, SGD, CHF, MYR, JPY, CNY};

172 changes: 172 additions & 0 deletions src/test/java/CurrencyConverterTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@

/*
*
* Created by amazing amy 2/16/18
*
* have a nice day
*
*
*/

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;


public class ConverterTest {

enum testCurrencyEnum {USD, EUR, GBP, INR, AUD, CAD, SGD, CHF, MYR, JPY, CNY};

private double getExchangeRate(testCurrencyEnum desiredXRate) {

//i am not yet sure if i need to use return or System.out.println(). I think it's the latter.
switch (desiredXRate) {
case USD:
System.out.println(1.00);
break;

case EUR:
return 0.94;
break;

case GBP:
return 0.82;
break;

case INR:
return 68.32;
break;

case AUD:
return 1.35;
break;

case CAD:
return 1.32;
break;

case SGD:
return 1.43;
break;

case CHF:
return 1.01;
break;

case MYR:
return 4.47;
break;

case JPY:
return 115.84;
break;

case CNY:
return 6.92;
break;

default:
return 0.00;

}

// Given
CurrencyType fromType = CurrencyType.USD;
CurrencyType toType = CurrencyType.EURO;
double fromAmount = 1.00;
double expected = 0.94;

// When
double actual = CurrencyConverter.convert(fromType, toType, fromAmount);

// Then
Assert.assertEquals(expected, actual);

// @Before
// public void setup () {
//
// testConverter = new Converter();
//
// }
//
// @Test
// public void dollarToEuroTest () {
// CurrencyConverter.dollarToEuroTest();
// double expected = 0;
// double actual = 0;
// Assert.assertequals(expected, actual, 0.001);
// }
//
// @Test
// public void euroToDollarTest () {
// CurrencyConverter.euroToDollarTest();
// double expected = 0;
// double actual = 0;
// Assert.assertequals(expected, actual, 0.001);
// }
//
// @Test
// public void dollarToBritishPoundTest () {
// CurrencyConverter.dollarToBritishPoundTest();
// double expected = 0;
// double actual = 0;
// Assert.assertequals(expected, actual, 0.001);
// }
//
// @Test
// public void poundToIndianRupeeTest () {
// CurrencyConverter.poundToIndianRupeeTest();
// double expected = 0;
// double actual = 0;
// Assert.assertequals(expected, actual, 0.001);
// }
//
// @Test
// public void rupeeToCanadianDollarTest () {
// CurrencyConverter.rupeeToCanadianDollarTest();
// double expected = 0;
// double actual = 0;
// Assert.assertequals(expected, actual, 0.001);
// }
//
// @Test
// public void CanadianDollarToSingaporeDollarTest () {
// CurrencyConverter.CanadianDollarToSingaporeDollarTest();
// double expected = 0;
// double actual = 0;
// Assert.assertequals(expected, actual, 0.001);
// }
//
// @Test
// public void singaporeDollarToSwissFrancTest () {
// CurrencyConverter.singaporeDollarToSwissFrancTest();
// double expected = 0;
// double actual = 0;
// Assert.assertequals(expected, actual, 0.001);
// }
//
// @Test
// public void swissFrancToMalaysianRingittTest () {
// CurrencyConverter.swissFrancToMalaysianRingittTest();
// double expected = 0;
// double actual = 0;
// Assert.assertequals(expected, actual, 0.001);
// }
// @Test
// public void japaneseYentoChineseYuanRenminbi () {
// CurrencyConverter.swissFrancToMalaysianRingittTest();
// double expected = 0;
// double actual = 0;
// Assert.assertequals(expected, actual, 0.001);
// }
// @Test
// public void malaysianRingittToJapaneseYuanTest () {
// CurrencyConverter.malaysianRingittToJapaneseYuanTest();
// double expected = 0;
// double actual = 0;
// Assert.assertequals(expected, actual, 0.001);
// }


}
}
Binary file added target/classes/CurrencyConverter.class
Binary file not shown.