0% found this document useful (0 votes)
3 views1 page

Currency Converter Code Explanation

The CurrencyRates class provides a mapping of currency codes to their respective exchange rates against INR. It includes methods to check if a currency is supported and to retrieve the exchange rate for a given currency. The supported currencies include INR, USD, EUR, GBP, and JPY.

Uploaded by

ritu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

Currency Converter Code Explanation

The CurrencyRates class provides a mapping of currency codes to their respective exchange rates against INR. It includes methods to check if a currency is supported and to retrieve the exchange rate for a given currency. The supported currencies include INR, USD, EUR, GBP, and JPY.

Uploaded by

ritu
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

package [Link].

converter;

import [Link];
import [Link];

public class CurrencyRates {


private final Map<String, Double> rates;

public CurrencyRates() {
rates = new HashMap<>();
[Link]("INR", 1.0);
[Link]("USD", 0.012);
[Link]("EUR", 0.011);
[Link]("GBP", 0.0095);
[Link]("JPY", 1.64);
}

public boolean isSupported(String currency) {


return [Link]([Link]());
}

public double getRate(String currency) {


return [Link]([Link](), -1.0);
}
}

You might also like