Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

public interface ConvertableCurrency {
default Double convert(CurrencyType currencyType) {

return Double.MAX_VALUE;
}
CurrencyType getType();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.zipcoder.currencyconverterapplication;

import java.util.Arrays;

public enum CurrencyType {
AUSTRALIAN_DOLLAR(2.70),
CANADIAN_DOLLAR(2.64),
Expand All @@ -25,6 +27,11 @@ public Double getRate() {
}

public static CurrencyType getTypeOfCurrency(ConvertableCurrency currency) {
return null;

return currency.getType();

}



}
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
package io.zipcoder.currencyconverterapplication.currencies;

import io.zipcoder.currencyconverterapplication.ConvertableCurrency;
import io.zipcoder.currencyconverterapplication.CurrencyType;

public class AustralianDollar implements ConvertableCurrency {
private CurrencyType type = CurrencyType.AUSTRALIAN_DOLLAR;
@Override
public Double convert(CurrencyType currencyType) {
Double result= currencyType.getRate()/ CurrencyType.AUSTRALIAN_DOLLAR.getRate();
return result;

}

@Override
public CurrencyType getType() {
return this.type;
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
package io.zipcoder.currencyconverterapplication.currencies;

import io.zipcoder.currencyconverterapplication.ConvertableCurrency;
import io.zipcoder.currencyconverterapplication.CurrencyType;

public class CanadianDollar implements ConvertableCurrency {
private CurrencyType type = CurrencyType.CANADIAN_DOLLAR;

@Override
public Double convert(CurrencyType currencyType) {
Double result= currencyType.getRate()/ CurrencyType.CANADIAN_DOLLAR.getRate();
return result;
}

@Override
public CurrencyType getType() {
return this.type;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
package io.zipcoder.currencyconverterapplication.currencies;

import io.zipcoder.currencyconverterapplication.ConvertableCurrency;
import io.zipcoder.currencyconverterapplication.CurrencyType;

public class ChineseYR implements ConvertableCurrency {
private CurrencyType type = CurrencyType.CHINESE_YR;
@Override
public Double convert(CurrencyType currencyType) {
Double result= currencyType.getRate()/ CurrencyType.CHINESE_YR.getRate();
return result;
}


@Override
public CurrencyType getType() {
return this.type;
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
package io.zipcoder.currencyconverterapplication.currencies;

import io.zipcoder.currencyconverterapplication.ConvertableCurrency;
import io.zipcoder.currencyconverterapplication.CurrencyType;

public class Euro implements ConvertableCurrency {
private CurrencyType type = CurrencyType.EURO;

@Override
public Double convert(CurrencyType currencyType) {
Double result= currencyType.getRate()/ CurrencyType.EURO.getRate();
return result;
}

@Override
public CurrencyType getType() {
return this.type;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
package io.zipcoder.currencyconverterapplication.currencies;

import io.zipcoder.currencyconverterapplication.ConvertableCurrency;
import io.zipcoder.currencyconverterapplication.CurrencyType;

public class Franc implements ConvertableCurrency {
private CurrencyType type = CurrencyType.FRANC;
@Override
public Double convert(CurrencyType currencyType) {
Double result= currencyType.getRate()/ CurrencyType.FRANC.getRate();
return result;
}

@Override
public CurrencyType getType() {
return this.type;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
package io.zipcoder.currencyconverterapplication.currencies;

import io.zipcoder.currencyconverterapplication.ConvertableCurrency;
import io.zipcoder.currencyconverterapplication.CurrencyType;

public class Pound implements ConvertableCurrency {
private CurrencyType type = CurrencyType.POUND;
@Override
public Double convert(CurrencyType currencyType) {
Double result = currencyType.getRate() / CurrencyType.POUND.getRate();
return result;
}


@Override
public CurrencyType getType() {
return this.type;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
package io.zipcoder.currencyconverterapplication.currencies;

import io.zipcoder.currencyconverterapplication.ConvertableCurrency;
import io.zipcoder.currencyconverterapplication.CurrencyType;

public class Ringgit implements ConvertableCurrency {
private CurrencyType type = CurrencyType.RINGGIT;
@Override
public Double convert(CurrencyType currencyType) {
Double result = currencyType.getRate() / CurrencyType.RINGGIT.getRate();
return result;
}


@Override
public CurrencyType getType() {
return this.type;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
package io.zipcoder.currencyconverterapplication.currencies;

import io.zipcoder.currencyconverterapplication.ConvertableCurrency;
import io.zipcoder.currencyconverterapplication.CurrencyType;

public class Rupee implements ConvertableCurrency {
private CurrencyType type = CurrencyType.RUPEE;
@Override
public Double convert(CurrencyType currencyType) {
Double result = currencyType.getRate() / CurrencyType.RUPEE.getRate();
return result;
}


@Override
public CurrencyType getType() {
return this.type;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
package io.zipcoder.currencyconverterapplication.currencies;

import io.zipcoder.currencyconverterapplication.ConvertableCurrency;
import io.zipcoder.currencyconverterapplication.CurrencyType;

public class SingaporeDollar implements ConvertableCurrency {
private CurrencyType type = CurrencyType.SINGAPORE_DOLLAR;

@Override
public Double convert(CurrencyType currencyType) {
Double result = currencyType.getRate() / CurrencyType.SINGAPORE_DOLLAR.getRate();
return result;
}


@Override
public CurrencyType getType() {
return this.type;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
package io.zipcoder.currencyconverterapplication.currencies;

import io.zipcoder.currencyconverterapplication.ConvertableCurrency;
import io.zipcoder.currencyconverterapplication.CurrencyType;

public class USDollar implements ConvertableCurrency {
private CurrencyType type = CurrencyType.US_DOLLAR;
@Override
public Double convert(CurrencyType currencyType) {
Double result = currencyType.getRate() / CurrencyType.US_DOLLAR.getRate();
return result;
}

@Override
public CurrencyType getType() {
return this.type;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
package io.zipcoder.currencyconverterapplication.currencies;

import io.zipcoder.currencyconverterapplication.ConvertableCurrency;
import io.zipcoder.currencyconverterapplication.CurrencyType;

public class UniversalCurrency implements ConvertableCurrency {
private CurrencyType type = CurrencyType.UNIVERSAL_CURRENCY;
@Override
public Double convert(CurrencyType currencyType) {
Double result = currencyType.getRate() / CurrencyType.UNIVERSAL_CURRENCY.getRate();
return result;
}

@Override
public CurrencyType getType() {
return this.type;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
package io.zipcoder.currencyconverterapplication.currencies;

import io.zipcoder.currencyconverterapplication.ConvertableCurrency;
import io.zipcoder.currencyconverterapplication.CurrencyType;

public class Yen implements ConvertableCurrency {
private CurrencyType type = CurrencyType.YEN;
@Override
public Double convert(CurrencyType currencyType) {
Double result = currencyType.getRate() / CurrencyType.YEN.getRate();
return result;
}

@Override
public CurrencyType getType() {
return this.type;
}
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.