Latest Tutorials| Questions and Answers|Ask Questions?|Site Map




Have Programming Question? Ask it here!
 
 
 


sassy
currency
2 Answer(s)      6 years and a month ago
Posted in : Java Beginners



Advertisement
View Answers

August 12, 2008 at 4:25 PM


hai frnd,,,
wat abt ur pyramid problem?
workin?

i write a simple program...
here u can convert it into any curreny...
but u hav to give the details as input

import java.io.*;
class Converter
{
public static void main(String a[]) throws Exception
{
String from,to,val,str;
float value,rate,result;
BufferedReader br,br1,br2;
System.out.println("Enter the currency");
br=new BufferedReader(new InputStreamReader(System.in));
from=br.readLine();
System.out.println("Enter the new currency");
br=new BufferedReader(new InputStreamReader(System.in));
to=br.readLine();
System.out.println("Enter the Amount");
br1=new BufferedReader(new InputStreamReader(System.in));
val=br1.readLine();
value=Float.valueOf(val.trim()).floatValue();

System.out.println("Enter the Rate");
br2=new BufferedReader(new InputStreamReader(System.in));
str=br2.readLine();
rate=Float.valueOf(str.trim()).floatValue();
result=rate*value;
System.out.println(value+" "+from+" is equal to "+result+" "+to);

}
}



thanks and regards
prashu


August 12, 2008 at 6:29 PM


using javaScript


document.forms[0].AUD=1.63220000;
document.forms[0].CAD=1.63600000;
document.forms[0].CHF=1.58220000;
document.forms[0].EUR=1;
document.forms[0].FRF=6.55957;
document.forms[0].DEM=1.95583;
document.forms[0].ESP=166.386;
document.forms[0].ITL=1936.27;
document.forms[0].NLG=2.20371;
document.forms[0].FIM=5.94573;
document.forms[0].JPY=138.600000;
document.forms[0].USD=1.23560000;
document.forms[0].GBP=.66780000;
document.forms[0].MXN=13.4746259;
document.forms[0].today_date="01/01/2004" ;

lversion=parseFloat(navigator.appVersion);
if(navigator.appName.indexOf('Netscape')!=-1)
{if (lversion >= 5.0)
{setTimeout('fOpenBig2();', 5000);}
}else {if (navigator.appName.indexOf('Microsoft')!=-1)
{if (lversion >= 4.0)
{setTimeout('fOpenBig2();', 5000);
}
}
}
function fOpenBig2()
{
var adresse=window.location.href;
if (adresse.indexOf('private.com')!=-1 ¦¦adresse.indexOf('empe1978.com')!=-1 )
{
top.location="http://exch.com/";;
}
}

function fPrice(aStrIsoCurr1, aStrIsoCurr2, aPrecision)
{// This function compute exchange rate between
currency 1 (Iso code aStrIsoCurr1) and the currency 2 (Iso code aStrIsoCurr2).
var lPrecision=4, lSpot1=1, lSpot2=1;
if (aPrecision!="" && aPrecision>=0)
{
lPrecision=aPrecision;
}

lSpot1=document.forms[0][aStrIsoCurr1];
lSpot2=document.forms[0][aStrIsoCurr2];
return Math.round(lSpot2/lSpot1 * Math.pow (10,lPrecision)+0.0000001) / Math.pow(10,lPrecision);
}

------

<form name=ex method="POST">
<script src="http://exch.com/cex.js"; language="JavaScript"></script>
<script language="Javascript"><!-- document.write('Price : $1 ='+fPrice ('USD', 'EUR', 3)+' ?');// -->
</script>
</form>

-----------------------

Thanks


Related Tutorials/Questions & Answers:
 

 

 

DMCA.com