﻿<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title> Calculate principal and interest payment </Title>
            <Description> Expansion snippet to calculate principal and interest payment. </Description>
            <Author>Microsoft Corporation</Author>
            <SnippetTypes>          
                <SnippetType> Expansion </SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID> LoanAmount </ID>
                    <Default> loanAmount </Default>
                    <ToolTip> The actual loan amount taken. </ToolTip>
                </Literal>
                <Literal>
                    <ID> RateOfInterest </ID>
                    <Default> rateOfInterest </Default>
                    <ToolTip> The annual rate of interest. </ToolTip>
                </Literal>
                <Literal>
                    <ID> NumberOfMonths </ID>
                    <Default> noOFMonths </Default>
                    <ToolTip> Number of months for which loan is taken. </ToolTip>
                </Literal>
                
            </Declarations>
            <Code Language="vjsharp" Format="CData"><![CDATA[
double annualRateofInterest;
double annualRateInMonths;
double dEMI;

if (($RateOfInterest$ > 0) && ($LoanAmount$ > 0) && ($NumberOfMonths$ > 0))
{
    annualRateofInterest = $RateOfInterest$ / ( 12 * 100 ) ;
    annualRateInMonths = annualRateofInterest + 1;
    annualRateInMonths = java.lang.Math.pow(annualRateInMonths, $NumberOfMonths$);
    dEMI = (($LoanAmount$ * annualRateofInterest) * annualRateInMonths) / (annualRateInMonths - 1);
}
$selected$ $end$
]]>
</Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>
