Performing Calculations in VB.NET
Our “Hello, world” program illustrated the basic structure of a VB.NET program, but we will need a slightly more elaborate example to show the use of other basic programming constructs, such as variables, expressions, and control structures. The example illustrates a number of features, which we will explain later. Our next example is a simple calculator for an IRA account. We calculate the accumulation of deposits to an IRA of $2000.00 a year at 6% interest for 10 years, assuming that each deposit is made at the end of the year. Our calculation is performed in two ways:
In a loop, year by year, accumulating a total as we go.
Using a formula.
The example program is in the folder Ira\Step1.
' Ira.vb - Step 1 Imports ...
Get Application Development Using Visual Basic® and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.