### continue with assignment quot loan program quot read code quot squareroottest quot 1 5150603

Continue with Assignment “Loan Program”. Read code “SquareRootTest”.

1. class Program
{

public static double loanAmount;
public static double years;
public static double interest;
static void Main(string[] args)
{

…..
//for loanAmount
do {

}while ( continueLoop );

…..
//for years
do {

}while ( continueLoop );

…..
//for interest
do {

}while ( continueLoop );

}
…..
}

2. Create a class “MyRangeException.cs”.

– loanAmount
– must be a number, threw FormatException if not
– must be greater than 50000, throw Exception if not
– Create a method CheckLoanAmount(double la)
throw new MyRangeException(“Loan Amount must be \$50,000 or more.”);

– loanInterest
– must be a number, threw FormatException if not
– must be greater than 1%, throw Exception if not
– Create a method CheckLoanInterest(double it)
throw new MyRangeException(“Interest Rate must be 1% or more.”);

– years
– must be a number, threw FormatException if not
– must be greater than 5, throgh Exception if not
– Create a method CheckLoanYears(double yr)
throw new MyRangeException(“Years must be 5 years or more.”);

=======================================================================================================

// Code from Loan Program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Loan_Program
{
class Program
{
static void Main(string[] args)
{

Console.Write(“Enter Loan Amount: \$”);
Console.Write(“Enter how many years: “);
Console.Write(“Enter Intrest rate: “);

C1.PayInterests(LoanAmount, Years, IntRate);

C1[] test = new C1[1];
test[0] = new C1(1, 1, 1);
foreach (var x in test)
{
Console.WriteLine(“{0}”, x.iMessage());
}

// calling method PayIntersts

}
}
}

class C1 // : IMyInterface
{

// constructor has the same name as class
// () called parameter
public C1(double loanAmount, double years, double interestRate)
{
// parameters
double LoanAmount = loanAmount;
double Years = years;
double InterestRate = interestRate;
}

// method
public static void PayInterests(double LoanAmount, double Years, double InterestRate)
{
double interests;
interests = LoanAmount * Years * InterestRate;
Console.WriteLine(“Loan Amount: \${0}”, LoanAmount);
Console.WriteLine(“Loan Length: {0}”, Years);
Console.WriteLine(“Loan Interest Rate: {0}”, InterestRate);
Console.WriteLine(“Loan Interest: \${0}”, interests);

}

public string iMessage()
{