views:

284

answers:

3

Hi I am writing an application java , is any way to write a java code to convert rupee to u.s. dollar and it shoud fetch the current u.s. dollar. I need the program in java

Thanks

+3  A: 

Google is our friend. I found this webservice which offers currency conhttp://www.webservicex.net/WS/WSDetails.aspx?WSID=10

Jay
Just a note: Strange, not all codes of ISO 4217 are listed in enumeration, e.g. I do not see Belarusian Ruble (BYR). It should be in the list at least, but the service may return "cannot convert". Ah, americans...
dma_k
There might be better services out there, that was the first one that came up in my search.
Jay
+3  A: 

You'll either hardcode the exchange rate in your application or database, or you'll be fetching that in real time (or asynchronously & cache every x minutes) from a third party site, for example http://www.google.com/search?q=1+usd+in+inr

cherouvim
So many ruppes :)
Tom
nice google feature, wasn't aware of that.
Jay
How do we read the result in java?
Logan
fetch the result into a string and parse (probably using a regex).
cherouvim
+2  A: 

In order to do this you would need to fetch the current exchange rate from a web service. The easiest way, if you just need to fetch a page, is something like this:

InputStream is = new URL("http://someexchangesite.com...").openStream();

Then read and parse the InputStream to find the exchange rate, and then use it with some simple multiplication!

Ricket