Trying to get this program working. It is supposed to ask the user for the exchange rate, then ask them for a amount in pounds and then conver the pounds to euro based on the exchange rate entered and display on screen. Just does not seem to work correctly.
Here is what i have:
<HTML>
<HEAD>
<TITLE>Euro convert</TITLE>
<SCRIPT>
var EuroRate = 1.40;
var response;
var amountInPounds, amountInEuros;
function twoDPs(anyNumber)
{
return Math.round (100 * anyNumber) / 100
};
function setEuroRate()
{
EuroRate = window.prompt(‘Enter prefured rate of exchange’,”);
}
function displayEuroRate()
{
document.write(‘Current Euro rate is ‘ + EuroRate + ‘ Euros to the Pound’)
}
function toEuros(numberOfPounds)
{
amountInPounds = window.prompt(‘enter amount in pound sterling’,”);
};
amountInEuros = amountInPounds * EuroRate;
// main program starts here
setEuroRate();
displayEuroRate();
response = window.prompt(‘do you want to convert any amounts from Pounds to Euros (Y/N)? ‘,”);
while(response == ‘Y’)
{
amountInPounds = window.prompt(‘enter amount in Pounds ‘,”);
amountInEuros = toEuros(amountInPounds);
document.write(‘£ ‘+ amountInPounds + ‘ is ‘ + amountInEuros + ‘ Euros’);
document.write(‘Conversion rate used was ‘ + EuroRate + ‘ E to the £’)
response = window.prompt(‘do you want to convert another amount (Y/N)? ‘,”)
}
</SCRIPT>
</HEAD>
<BODY>
</BODY>
</HTML>