473,323 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

need help!

3
this for loop runs a set number of times. it is used to execute a group of lines repeatedly. computing the monthly loan payment is a good demonstration for a loop. the monthly loan payment is a fixed sum that is composed of both interest and principle repayment.

Please help me!


Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.  
  3.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  4.  
  5.     End Sub
  6.  
  7.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  8.         Dim loan As Single = Val(TextBox1.Text)
  9.         Dim interest As Single = 9%
  10.         Dim numberofyears As Single = Val(TextBox2.Text)
  11.         Dim monthlypayment, monthlyrate, numberofpayments, count As Single
  12.         monthlyrate = 1 + (interest / (12 * 100))
  13.         numberofpayments = numberofyears * 12
  14.         monthlypayment = (loan * interest * monthlyrate ^ numberofpayments) / (1200 * ((monthlyrate ^ numberofpayments) - 1))
  15.  
  16.         Dim interestpart, loanpart, Balance As Single
  17.         For count = 1 To numberofpayments
  18.             interestpart = loan * (interest * 9) / 12
  19.             loanpart = monthlypayment - interestpart
  20.             Balance = loan - loanpart
  21.         Next
  22.         Dim paymentoutput As Single
  23.         Label1.Text = paymentoutput & "Payment #" & count & vbTab & _
  24.         Format(loan, "C") & " " & vbTab & FormatCurrency(interestpart) & vbTab & _
  25.         FormatCurrency(loanpart) & vbTab & FormatCurrency(Balance) & vbCrLf
  26.     End Sub
  27. End Class
Oct 31 '13 #1
1 1143
Killer42
8,435 Expert 8TB
What do you need help with? All you've done is describe what the For loop does.
Nov 20 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Gregory Nans | last post by:
hello, i need some help to 'tree-ify' a string... for example i have strings such as : s = """A(here 's , B(A ) silly test) C(to show D(what kind) of stuff i need))""" and i need to...
0
by: xunling | last post by:
i have a question about answering ..... this topic is "need help" what do i have to write at te topic line, !after i have klicked the "answer message" button ive tried many possibilities,...
2
by: Paul Mendez | last post by:
I really need some help Date Code ConCAT Bal_Fwd NS_Fees Amt_Coll Cur_End_Bal 1/15/2004 KW 11KW2003 $500.00 $250.00 $250.00 2/15/2004 KW 12KW2003 $300.00 $500.00 ...
7
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
8
by: Elliot M. Rodriguez | last post by:
I am having a heckuva time debugging this, or determining why my page is behaving this way. I have a search form, that when completed, returns a datagrid. When the user selects a row (normal...
3
by: Rich Squid | last post by:
Hello Here's my basic problem: On my asp.net form page I have a DetailsView (default mode=edit) bound to a AccessDataSource control. Users can successfuly update a databound template field,...
2
by: XML Beginner | last post by:
I have an XML file that contains values that my application needs, so it knows which database to connect to. It also contains a configuration option so that I can specify which node to return...
2
by: =?Utf-8?B?am9lb2ppaA==?= | last post by:
Most students do not have enough time to do their homeworks, assignments, college papers, etc alone. Also most of them, even though they know what to do with respect to their writing assignment,...
30
by: carlos123 | last post by:
Ok I am working on a Hall Pass program for my computer programming class. There are 3 things that I am confused on. 1. Reading a file. 2. Taking that data read from the file and putting it into...
1
by: jhaydon | last post by:
First of all, I'm not a CSS expert. If I was, I wouldn't need to be posting for help here. Secondly, I have been doing web design for several years, just not css. Thirdly, I need help and hope...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.