The software shall calculate the monthly home loan repayment for buying a property
based on the values that the user entered. (See
https://www.sivavula.com/read/maths/grade-10/finance-and-growth/09-finance-and
growth-03 for more information on how to calculate this).
6.
If the monthly home loan repayment is more than a third of the user's gross monthly income, the software shall alert the user that approval of the home loan is unlikely.
7.
The software shall calculate the available monthly money after all the specified deductions
I have been made.
8.
The software shall not persist the user data between runs. The data shall only be stored in
memory while the software is running.
internal class Program
{
static void Main()
{
Console.Write("Enter gross monthly income: ");
double grossMonthly = double.Parse(Console.ReadLine());
Console.Write("Enter the principal loan amount: ");
double loanAmount = double.Parse(Console.ReadLine());
Console.Write("Enter monthly interest rate: ");
double rate = double.Parse(Console.ReadLine());
Console.Write("Enter of payments over the loan’s lifetime");
double n = double.Parse(Console.ReadLine());
double monthlyPayment = loanAmount * (rate * Math.Pow(1 + rate, n) / (Math.Pow(1 + rate, n) - 1));
if (monthlyPayment > grossMonthly / 3)
Console.WriteLine("Approval of the home loan is unlikely.");
Console.WriteLine($"Available money after payment: {grossMonthly-monthlyPayment}");
Console.ReadKey();
}
}
Comments
Leave a comment