|
-
Oct 28th, 2002, 05:15 PM
#1
Thread Starter
New Member
what am I doing wrong??
PLEASE HELP ME!!! otherwise I will have a nervous breakdown, I'm learning javasript(very new to this)and have been ask to write a code to work out simple interest rate. here is my feeble attempt at it;<html>
<head>
<title> Headwreaker</title>
<script type = "text/javascript">
<!--
var Name, // first string entered by user
Address, // second string entered by user
DOB, // Date of Birth
Occupation, // job
p, //Amount entered by user
n, //How long the loan is for in years
i, // interest
fixedInterest,
amount,
years,
firstno,
secno,
// read in name from user as a string
Name =
window.prompt( "Enter name", "" );
// read in address from user as a string
Address =
window.prompt( "Enter address", "" );
// read in DOB from user as a string
DOB =
window.prompt( "Enter DOB", "" );
// read in Occupation from user as a string
Occupation =
window.prompt( "Enter Occupation", "" );
// read in Amount from user as a string
p=
window.prompt( "Enter the amount of loan ", "0" );
// read in Period from user as a string
n=
window.prompt( "Enter the loan in years", "0" );
// convert numbers from strings to integers
p = parseFloat(firstno);
n = parseFloat(secno);
// Simple intrest
// Formula i = interest P amount n No of years
// A = amount after No of years
sum = Math.(p*(1+n*i));
//function to calculate Fixed interest
//function Interest()
//var i=0.088;
//var fixedInterest=P*(1)+(n);
document.write("sum",+ sum);
</script>
</head>
<body>
<p>Click Refresh (or Reload) to run the script again</p>
</body>
</html>
It would be much appericated otherwise I'll have to phone the samatrians!!!
Thanx Lisa
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|