PDA

View Full Version : plz help



java dummie
Jun 25th, 2007, 07:42 PM
I have been writing a program to store the interest rates for different institutions for current accounts, savings accounts and
e-savings accounts. These interest rates should be printed out
on request.my question is to Write the main part of the program in which a user is repeatedly
asked whether they want to add a new institution (A or a),
print out the rates (P or p) or quit (Q or q) and which calls
the appropriate function. Note that the program should accept
the input in upper or lower case. If the user inputs an
unrecognised input then the program should just continue to
prompt for the next action. so far i have got this but really stuck on what to do next. please help me, i am not looking for the full answer just some hints and tips will do.
Thanks
<HTML>
<HEAD> bank rates
<TITLE>Enter a number </TITLE>
<SCRIPT language="JavaScript" >

var institutionArray = ['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.2','0','0','0','0','0','0','0'];

var esavingsArray = ['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)? ','');
{
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)? ','')
document.write(' '+ amountInPounds + ' attracts ' + interest + ' interest');
</script>
</head>
<body>
</body>
</html>

Philip M
Jun 26th, 2007, 11:10 AM
You are by no means the only person attempting this assignment (examination?). See e.g.

http://www.codingforums.com/showthread.php?t=116912

The above has received over 700 hits, which suggests that other exam students are seeking inspiration here as well.

The rules of the forum discourage requests for help with homework. What you submit to your examiners is supposed to be your own work, not retrieved from a public web forum.

As I say, remember that others are watching, possibly even your examiners.

Also, please have a look at the guidelines regarding thread titles.