Could anyone help with this please….With use of the following program my task is to now expand it in order for it to cope with four currencies (as shown below)
Dollar (USD) = 1 dollar
Euro (EUR) = 1.27 dollars
Poundsterling (GBP) = 1.85 dollars
japaneseYen (JPY) = 0.0085 dollars
var currencyType, amountEntered, amountConverted,euro,dollars;
currencyType = 0;
amountEntered = 0;
amountConverted = 0;
euro = 1;
dollar = 1.27;
currencyType = window.prompt(‘Please enter the currency 0) Dollar 1) Euro’, ‘ ‘);
currencyType = parseInt (currencyType);
while (currencyType < 0 currencyType >1)
{
currencyType = window.prompt(‘Please re-enter – currency should be 0 or 1’, ‘ ‘);
currencyType = parseInt (currencyType);
}
if (currencyType == 1)
{
currencyType = “dollars”;
}
else
if (currencyType ==1)
{
currencyType = “euro”;
}
amountEntered = window.prompt(‘Please enter the amount to be converted’, ‘ ‘);
amountEntered = parseFloat (amountEntered);
if (currencyType==”dollars”)
{
amountConverted = (amountEntered / dollars);
document.write(‘<BR>’ + amountEntered + ‘ of type ‘ + currencyType + ‘ is ‘ + amountConverted + )
{
else
if (currencyType==”euro”)
}
amountConverted = (amountEntered * dollars);
}
1.I need to prompt the user to first input a number to convert from(0 for dollars, 1 for euro, 2 for poundsterling and 3 for japaneseyen)
2.Prompt the user to input a number to convert to(0 for dollars, 1 for euro, 2 for poundsterling and 3 for japaneseyen)
3.Prompt the user to input the amount to be converted
4.Include the names of the currencies and their three-letter codes.