Question: I need some C# prograaming help I wrote 3 files for the original assignment ( Below is the code ) PROGRAM.cs using ConsoleApp 6 ;
I need some C# prograaming help
I wrote files for the original assignment Below is the code
PROGRAM.cs
using ConsoleApp;
class Program
public static double loanAmount;
public static double years;
public static double interest;
static void Mainstringargs double loanAmount
Console.WriteEnter loan amount: ;
double loanAmount Convert.ToDoubleConsoleReadLine;
Console.WriteEnter number of years: ;
double years Convert.ToDoubleConsoleReadLine;
Console.WriteEnter interest rate in decimal form, eg for : ;
double interestRate Convert.ToDoubleConsoleReadLine;
C loanInfo new CloanAmount years, interestRate;
double totalInterests loanInfo.PayInterests;
Console.WriteLine$"Total interest to be paid: totalInterests:C;
string message loanInfo.iMessage;
Console.WriteLinemessage;
private static void CheckLoanAmountdouble loanAmount
throw new NotImplementedException;
IMYInterface.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp
interface IMyInterface
string iMessage;
Ccs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp
class C : IMyInterface
private double loanAmount ;
private double years ;
private double interestRate ;
private double interests ;
public Cdouble loanAmount, double years, double interestRate
this.loanAmount loanAmount;
this.years years;
this.interestRate interestRate;
public double PayInterests
interests loanAmount interestRate years;
return interests;
public string iMessage
return Be Ready!";
public double LoanAmount
get return loanAmount;
set loanAmount value;
public double Years
get return years;
set years value;
public double InterestRate
get return interestRate;
set interestRate value;
Here is the second part that I need help with.
Create a class "MyRangeException.cssimilar to example code
In "Program.cs in main Add Exception Handling
class Program
public static double loanAmount;
public static double years;
public static double interest;
static void Mainstring args
for loanAmount
do
try
Console.WritePlease enter the loan amount: $;
loanAmount Convert.ToDoubleConsoleReadLine;
CheckLoanAmount loanAmount;
continueLoop false;
catch FormatException formatException
Console.WriteLine
formatException.Message ;
Console.WriteLine "Please enter a double value.
;
end catch
catch MyRangeException negativeNumberException
Console.WriteLine
negativeNumberException.Message ;
ConsoleWriteLine "Please enter a nonnegative value.
;
end catch
while continueLoop;
for years
do
while continueLoop ;
for interest
do
while continueLoop ;
Requirement similar to the example: Add methods to check the value
loanAmount
must be a number, threw FormatException if not
must be greater than throw Exception if not
Create a method CheckLoanAmountdouble la
throw new MyRangeExceptionLoan Amount must be $ or more.";
public static void CheckLoanAmountdouble la
if la
throw new MyRangeException "Loan Amount must be $ or more.";
loanInterest
must be a number, threw FormatException if not
must be greater than throw Exception if not
Create a method CheckLoanInterest
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
