Forum Moderators: open
<script type="text/javascript">
var bankNamesArray = Pennygo Bank, Cardew Bank, Summer Bank;
var currentArray = [2.0,1.5,1.8,0,0,0,0,0,0,0];
var savingsArray = [4.0,3.75,4.75,0,0,0,0,0,0,0];
var eSavingsArray = [4.5,4.75,4.2,0,0,0,0,0,0,0];
var bankArray = new Array(10);
var userNumber;
function addInstitution ()
{
bankNames = window.prompt('Please enter the name of your bank ', 'bankNamesArray')
current = window.prompt('Please enter your Current account rate ', "")
userNumber = parseFloat(userInput);
savings = window.prompt('Please enter your Savings account rate ', "")
userNumber = parseFloat(userInput);
eSavings = window.prompt('Please enter your eSavings account rate ', "")
userNumber = parseFloat(userInput);
};
function displayRates()
{
for (var bank = 0; bank < bankArray.length; bank = bank + 1)
document.write(bankNamesArray[bank] + ' : ' + currentArray[bank]'<BR>' + savingsArray[bank]'<BR>' +eSavingsArray[bank]'<BR>')
};
// Main program starts here
addInstitution();
display();
document.write('<BR><BR><BR><BR>');
response = window.prompt('Do you want to calculate the interest on an amount of money (Y/N)? ','');
while(response == 'Y' ¦¦ response == 'y')
{
amountInPounds = window.prompt('Enter amount in Pounds ','');
interest = calculateInterest(amountInPounds);
document.write('£ '+ amountInPounds + ' attracts £' + interest + ' interest');
document.write('<BR><BR><BR>');
response = window.prompt('Do you want to calculate the interest for another amount (Y/N)? ','')
}
</script>
For example, you prompt current account rate, savings account rate, and esavings rates but you don't do anything with the values you get.
Further to that, you were referencing 10 elements and trying to print the values from the arrays above, but you only had 3 values in the bank names.
Hope this help, and if you need further help just clarify what you're trying to accomplish.
<html>
<head>
<title>Testing</title>
<script>
var bankNamesArray = new Array("Pennygo Bank", "Cardew Bank", "Summer Bank");
var currentArray = new Array(2.0,1.5,1.8,0,0,0,0,0,0,0);
var savingsArray = new Array(4.0,3.75,4.75,0,0,0,0,0,0,0);
var eSavingsArray = new Array(4.5,4.75,4.2,0,0,0,0,0,0,0);
var userNumber;function addInstitution()
{
bankNames = window.prompt('Please enter the name of your bank ', bankNamesArray)
current = parseFloat(window.prompt('Please enter your Current account rate ', ""));
savings = parseFloat(window.prompt('Please enter your Savings account rate ', ""));
eSavings = parseFloat(window.prompt('Please enter your eSavings account rate ', ""));
};function displayRates()
{
for (var bank = 0; bank < bankNamesArray.length; bank++)
document.write(bankNamesArray[bank] + ' : ' + currentArray[bank] + '<BR>' + savingsArray[bank] + '<BR>' +eSavingsArray[bank] + '<BR>');
};// Main program starts here
addInstitution();
displayRates();
document.write('<BR><BR><BR><BR>');
response = window.prompt('Do you want to calculate the interest on an amount of money (Y/N)? ','');
while(response.toLowerCase() == 'y')
{
amountInPounds = window.prompt('Enter amount in Pounds ','');
interest = calculateInterest(amountInPounds);
document.write('£ '+ amountInPounds + ' attracts £' + interest + ' interest');
document.write('<BR><BR><BR>');
response = window.prompt('Do you want to calculate the interest for another amount (Y/N)? ','')
}
</script>
</head>
<body>
</body>
</html>
That's all I need the program to do. Thanks for your time
It's fine asking for hints, tips, and pointers to where you have slipped up, but, when you come to hand in your work, you should supply links to any forum threads where you have asked questions about the project. So it's best to limit the scope of your questions in a way that your tutor would find acceptible.
This is basic stuff, so I'd recommend going back and starting again.
Follow the instructions carefully. For instance, the array, bankNamesArray, should be length 10, with the remaining positions filled with empty strings (acc. to instructions).
Take everything one step at a time. The first function in your brief, addInstitution, isn't anywhere near correct in your code, so there's no point in doing ay other functions yet.