SIGN UP MEMBER LOGIN:    
ARTICLE

Financial Calculation using .NET: Part I

Posted by Shivprasad Articles | ASP.NET Programming March 18, 2009
In this part we will understand how we can calculate the future value for a given rate of interest, period and monthly invested amount.
Reader Level:
Download Files:
 

Introduction

In finance world many times we need to calculate general financial calculation like interest calculation, regression analysis, internal rate of return etc. .NET does not provide readymade functions for these regular financial functionalities. Building these functionalities from scratch is not a big thing but testing it end to end with different scenarios is a challenge. We will try to understand how we can reuse 'Financial' classes from Microsoft.VisualBasic namespace. These functions are time tested and you do not need to code from scratch.

In this part we will understand how we can calculate the future value for a given rate of interest, period and monthly invested amount.

I have uploaded a sample source code which has a simple UI to calculate the future value.

Understanding the future value fundamental

First let us understand how future values are calculated in finance domain. Let's say you have decided to invest for two year in some scheme. Let's say the amount is 1000 (I am not thinking in terms of INR, $ or pounds) at rate of interest of 10%. So for the first month you will invest 1000 with 10% interest in the second month you will get 1100. Now in second month you invest 1000, so the total is 1000 + 1100. Now the rate of interest on 2100 is 210. So after two months you will get 2310.

1.jpg

The above calculation is nothing but future value calculation. This is available as a readymade function in 'Microsoft.VisualBasic' namespace. Once you import the name space you will get a 'Financial' static class which has a 'FV' function. This function takes in rate of interest , number of months and amount per month. Once we give this it calculates the value you will get after the defined period. I have wrapped the 'Financial.FV' function in a class 'ClsFutureValue'.

2.jpg

Download the source code from the top attached with this article to see how the FV function works. Below is the screen shot of the sample project.

3.jpg

Login to add your contents and source code to this article
share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
    Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor