Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 2nd, 2004, 08:11 PM
Activexcode Activexcode is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 2 Activexcode User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Investment Calculator - need it to calculate properly. Please check my syntax.

I created an investment calculation form in Microsoft Visual Studio 2003, designed to post as a form on the web. When it posts to the web, the user should be able to:

1)Put in ANY amount in the initial investment box (say, 200, just as an example)

2)Put in ANY expected annual rate of return (say, 8%, just as an example)

3)Put in ANY number of years (say, 6, just as an example)
4)Press the CALCULATE the FUTURE VALUE button.

Once the user presses the CALCULATE the FUTURE VALUE button, he should see a two-column table, underneath the form, which shows a (compounded annually) running total (in this example, 6 years):

Year 1 $216
Year 2 $233.28
Year 3 $251.9424
Year 4 $272.097792
Year 5 $293.86561536
Year 6 $317.3748645888

Here's my original code. I can't get it to compound annually from Year 1 on, as described above. (It shows Years 1 through 6 as all $216. That's WRONG. Year 2 should compute $233.28, Year 3 should compute $251.94, and so on.)

In addition, I'm having trouble creating the two-column table. Col 1 should show the number of years. Col 2 Should show a dollar sign, followed by the running total per year. In addition, the final year and respective amount should be in BOLD. Please correct and flesh out my syntax where necessary. Thanks for your expertise! I really appreciate it! :-}
__________________________________________________ ______________________________________
<%
DIM counter, initialinvestment, annualrateofreturn, numberofyears, investmentvalue

initialinvestment = request.form ("initial investment")
response.write ("Initial investment is:" & initialinvestment & "<br/>")

annualrateofreturn = request.form ("annual rate of return")
response.write ("Annual rate of return is:" & annualrateofreturn & "<br/>")
numberofyears = request.form ("number of years")
response.write ("Number of years:" & numberofyears & "<br/>")

investmentvalue = initialinvestment*(1 + annualrateofreturn)

for counter = 1 to numberofyears
response.write(counter&" " & "<br/>")
investmentvalue = initialinvestment*(1 + annualrateofreturn/100)
'percents will be inserted as (for example)8%, not 0.08

response.write (investmentvalue&" " &"<br/>")
next
%>
<form method = "post" action= "InvestmentCalc.asp">
<h3>Investment Calculator</h3>

<b>Initial Investment:</b
<input type= "text" name= "initial investment" value='<%= initialinvestment%>'/><br/>

<b>Expected Annual Rate of Return %:</b>
<input type="text" name="annual rate of return" size = "10" maxlength = "10" value="<%= annualrateofreturn%>"/><br/>

<b>Number of Years:</b>
<input type="text" name="number of years" size = "3" maxlength = "3" value="<% =numberofyears%>"/></p>

<input type="submit" value="Calculate the Future Value"/></p>

</form>
'The two-column table should appear here'
</body>

</html>

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > Investment Calculator - need it to calculate properly. Please check my syntax.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT