Forum Moderators: open
I have to convert euros to U.S. dollars. I have to start by prompting the user to enter the number of euros to be converted. The program has to multiply this value by 1.24, which will give the number of U.S. dollars equivalent to the number of euros. Then the program should print out the number of euros and the conversion to the number of dollars. Here's an example.
Enter the number of euros: 4.60
4.60 euros is $5.704 US
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Untitled</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function currConv(){
var curr_in=prompt("Enter your Euro amount: ", 1);
alert(curr_in+" Euros converts to $"+(curr_in*1.24)+" U.S.");
}
</script>
</head>
<body onload="currConv();">
</body>
</html>
I hope this helps. I delayed explanation to give you some time to cogitate, digest, and ruminate. (Not to suggest that you are a ruminant; that's more a tribble's domain.)
One thing to mention:
I would check to make sure they really want you to code this with the exchange rate of U.S. dollars to Euros
*****FIXED*****
at 1.24!
Exchange rates vary quite a bit over time. I suspect whomever gave you the 1.24 number was just providing an example, using something close to the current value in the marketplace at the time; it WILL change -- and has already since you posted.
Suggest you check this issue out with whomever gave you the 1.24 "programming spec". You most likely will have to find a source of up to date (if not up to the minute) exchange rate data. Suggest trying google for a data source if you or your company doesn't have one already picked out for you to use. One site that does exchange rates I found via google is xe dot com. You might find looking at their site gives you some helpful ideas.
Also, whomever gives you the "spec" for this task might want to specify both how and to what decimal place to round the conversion. For instance, I doubt they would want you to tell customers the (converted) price will be 4.5678 dollars or Euros...rather than 4.57 dollars or Euros.
Hope this helps you out,
Louis