private double _Principal;
if (value >= 0.01 && value <= 0.99)
if (value >= 1 && value <= 360)
public double MonthlyPayment {get;set;}
public double TotalCost {get;set;}
public double TotalInterest {get;set;}
public Mortage(double p, double i, int t){
public void CalculatePayment()
MonthlyPayment = Principal * (MonthlyIR * Math.Pow((MonthlyIR + 1), Terms)) / ((Math.Pow((MonthlyIR + 1), Terms)-1));
TotalCost = MonthlyPayment * Terms;
TotalInterest = TotalCost - Principal;
public double ClosingFees;
public void CalculateClosingFees()
ClosingFees = 0.005 * Principal;
ClosingFees = 0.004 * Principal;
ClosingFees = 0.006 * Principal;
public static void Main (string[] args) {
Console.WriteLine("Please enter principal value.");
strPrincipal = Console.ReadLine();
success = double.TryParse(strPrincipal, out Principal);
Console.WriteLine("Please enter a valid principal value.");
Console.WriteLine("Please enter the interest Rate.");
strRate = Console.ReadLine();
success2 = double.TryParse(strRate, out IRate);
if (IRate >= 0.01 && IRate <= 0.99){}
Console.WriteLine("Please enter a valid interest Rate.");
Console.WriteLine("Please enter the number of terms (months).");
strTerms = Console.ReadLine();
success3 = int.TryParse(strTerms, out Terms);
if (Terms >= 1 && Terms <= 360){}
Console.WriteLine("Please enter a valid number of terms (months).");
Mortage M1 = new Mortage (Principal, IRate, Terms);
Console.WriteLine("========================");
Console.WriteLine("Monthly Payment: " + M1.MonthlyPayment.ToString("C2"));
Console.WriteLine("Total Cost " + M1.TotalCost.ToString("C2"));
Console.WriteLine("Total Interest: " + M1.TotalInterest.ToString("C2"));
M1.CalculateClosingFees();
Console.WriteLine("Closing Fees: " + M1.ClosingFees.ToString("C2"));