2. The user shall be able to choose between renting accommodation or buying a property. 3.
If the user selects to rent, the user shall be able to enter the monthly rental amount. 4. If the user selects to buy a property, the user shall be required to enter the following
values for a home loan:
a. Purchase price of the property
b. Total deposit
c. Interest rate (percentage)
d. Number of months to repay (between 240 and 360)
using System;
namespace choose
{
class Program
{
public static void Main(string[] args)
{
int choose;
int mont_rent, purch_price, total_dep, interest, num_monts;
Console.WriteLine("Options:");
Console.WriteLine("(1) - renting accommodation");
Console.WriteLine("(2) - buying accommodation");
Console.Write("Choose: ");
choose = Convert.ToInt32(Console.ReadLine());
if (choose == 1)
{
Console.Write("Enter the monthly rental amount: ");
mont_rent = Convert.ToInt32(Console.ReadLine());
}
else if (choose == 2)
{
Console.Write("Enter purchase price of the property: ");
purch_price = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter total deposit: ");
total_dep = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter interest rate (percentage): ");
interest = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter number of months to repay: ");
num_monts = Convert.ToInt32(Console.ReadLine());
while ((num_monts < 240) | (num_monts > 360))
{
Console.WriteLine("Input invalid: The number of months to repay must be between 240 and 360.");
Console.Write("Please re-enter number of months to repay: ");
num_monts = Convert.ToInt32(Console.ReadLine());
}
}
Console.Write("\nPress any key to continue . . . ");
Console.ReadKey(true);
}
}
}
Comments
Leave a comment