Loan EMI Calculator using C#.NET

EmiCalculator.aspx (Design Code):


  • <%@ Page Language="C#" AutoEventWireup="true" Culture="en-IN" CodeBehind="EMICalculator.aspx.cs" Inherits="AspDemo.EMICalculator" %>

  • <!DOCTYPE html>

  • <html xmlns="http://www.w3.org/1999/xhtml">
  • <head runat="server">
  •     <title></title>
  • </head>
  • <body>
  •     <form id="form1" runat="server">
  •     <div>
  •     
  •         <table class="auto-style1">
  •             <tr>
  •                 <td class="auto-style2" colspan="2"><strong>Loan EMI Calculator</strong></td>
  •             </tr>
  •             <tr>
  •                 <td class="auto-style6">Amount</td>
  •                 <td class="auto-style4">
  •                     <asp:TextBox ID="txtAmount" runat="server" 
  • CssClass="auto-style5" PlaceHolder="&#8377;" autofocus></asp:TextBox>
  •                 </td>
  •             </tr>
  •             <tr>
  •                 <td class="auto-style6"><span class="auto-style5">Duration</span><br class="auto-style5" />
  •                     <span class="auto-style5">(In Months)</span></td>
  •                 <td class="auto-style8">
  •                     <asp:TextBox ID="txtMonths" runat="server" CssClass="auto-style5"></asp:TextBox>
  •                 </td>
  •             </tr>
  •             <tr>
  •                 <td class="auto-style6">Interest Rate</td>
  •                 <td class="auto-style8">
  •                     <asp:TextBox ID="txtRate" runat="server" 
  • CssClass="auto-style5" PlaceHolder="%"></asp:TextBox>
  •                 </td>
  •             </tr>
  •             <tr>
  •                 <td class="auto-style10">EMI Calculated</td>
  •                 <td class="auto-style11"><strong>
  •                     <asp:TextBox ID="txtEMI" runat="server" CssClass="auto-style7" ReadOnly="True" Width="200px" BackColor="White"
  •  ForeColor="Black" Enabled="false"></asp:TextBox>
  •                     </strong></td>
  •             </tr>
  •             <tr>
  •                 <td class="auto-style6">&nbsp;</td>
  •                 <td class="auto-style9">
  •                     <asp:Button ID="btnCalculate" runat="server" Text="Calculate" 
  • CssClass="auto-style5" OnClick="btnCalculate_Click" />
  •                 </td>
  •             </tr>
  •         </table>
  •     
  •     </div>
  •     </form>
  • </body>
  • </html>

EmiCalculator.aspx.cs (Code)

Write following code on Calculate button click event.
  •        int amount,month;
  •         double interestRate, emiCalculated;
  •         protected void btnCalculate_Click(object sender, EventArgs e)
  •         {
  •             amount = int.Parse(txtAmount.Text);
  •             month = int.Parse(txtMonths.Text);
  •             interestRate = double.Parse(txtRate.Text)/12/100;

  •             emiCalculated = amount * interestRate * 
  • ((Math.Pow(1 + interestRate, month)) /
  • (Math.Pow(1 + interestRate, month)-1));

  •             txtEMI.Text = emiCalculated.ToString("c");
  •         }

Comments

  1. Are you looking for a business loan, personal loans, mortgage loans, car loans, student loans, unsecured consolidation loans,project funding etc ... Or simply refuse loan from a bank or financial institution for one or more reasons? We are the right solutions for credit! We offer loans to businesses and individuals with low and affordable interest rate of 2%. So if you are Interested in an urgent and secured loan. For more information kindly email us today Via: elegantloanfirm@hotmail.com.



    ReplyDelete

Post a Comment

Popular posts from this blog

Code First Approach with Entity Framework

Getting Ready for Python Development on Ubuntu using VSCode

Designing Model class with validation in ASP.NET MVC