/    Sign up×
Community /Pin to ProfileBookmark

a bit of help for a newbie please

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>

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceMar 25.2006 — So, tell us what goes wrong. Don't make us figure everything out by ourselves.
×

Success!

Help @airwolfdirectuk spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...