Question

Locked

Struggling with OU Course javascript

By stevesu ·
Can anyone help,(I'm struggling with javascript module on course)
question reads-:

Your task is now to expand this program to cope flexibly with
four currencies, as follows:
Dollar (USD) = 1 dollar
Euro (EUR) = 1.27 dollars
Pound sterling (GBP) = 1.87 dollars
Japanese yen (JPY) = 0.0085 dollars
Your program should do the following:
1. Prompt the user to input a number indicating a currency to
convert from (0 for dollars, 1 for euros, 2 for pounds and
3 for yen).
2. Prompt the user to input a number indicating a currency to
convert to (0 for dollars, 1 for euros, 2 for pounds and 3 for yen).
3. Prompt the user to input the amount to be converted.
page 5 of 15
4. Perform the conversion and write the result to the screen,
including the names of the currencies and their three-letter codes.
In other words, your program should be able to convert between
any two of the four currencies. The output should resemble the
ones we have illustrated in (b) below. Hint 1: use three parallel
arrays to store the currency names, codes and conversion rates.
Hint 2: convert between currencies by converting to dollars and
then from dollars into the target currency.
(a) Update your program so that it performs correctly according
to the specification in part (iii), including the actual
conversion of the currency. Use the conversion ratios
supplied.
Insert a copy of your completed program into the document
containing your solution. [10]
(b) Run your program with each of the following inputs:
Dollars → Euros Amount 450
Euros → Pounds Amount 320
Pounds → Euros Amount 179
Yen → Pounds Amount 125
The output from your program should resemble the
following:
450 Dollar (USD) is 354.3307086614173 (EUR) Euro
320 Euro (EUR) is 217.32620320855614 (GBP) Pound
179 Pound (GBP) is 263.56692913385825 (EUR) Euro
125 Yen (JPY) is 0.5681818181818181 (GBP) Pound
For each run insert a screen shot of the browser window into
the document containing your solution.

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Back to Web Development Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums