static void Main(string[] args)
{
while (true) //主要就是公式的运用和if else 的嵌套
{
string a, b = "";
double c, d, e,s,q;
double m = 6.55 / 100 / 12; double n = 4.05 / 100 / 12;
int x;
Console.WriteLine("请选择房贷类型(商业贷款or公积金贷款):");
a = Console.ReadLine();
if (a == "商业贷款")
{
Console.WriteLine("请输入贷款金额(元):");
c = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入贷款期限(月):");
d = Convert.ToDouble(Console.ReadLine());
q = c / d;
Console.WriteLine("请输入还款方式(等额本息or等额本金):");
b = Console.ReadLine();
if (b == "等额本金")
{
Console.WriteLine("您的期次为(就是贷款后的第几个月):");
x = Convert.ToInt32(Console.ReadLine());
s = (d + 1) * c * (m / 2);
e = c / d + (c - (x - 1) * q) * m;
Console.WriteLine("您本月还款金额为" + e + "元");
Console.WriteLine("您本月利息为" + (e - q) + "元");
Console.WriteLine("您的利息总和为" + s + "元");
Console.WriteLine("您的本利总和为" + (s + c) + "元");
Console.WriteLine("您的本月月供为" + e+ "元");
//Console.WriteLine("您的累计归还总额为"e1+e2+……ex + "元");
Console.WriteLine("您的期次为" + x);
Console.WriteLine("您本月的偿还本息为" + e + "元");
Console.WriteLine("您本月的偿还利息为" + (e - q) + "元");
Console.WriteLine("您迄今为止偿还的本金为" + (x * q) + "元");
Console.WriteLine("您迄今为止尚未偿还的本金为" + (c - x * q) + "元");
if (x == 1)
{
Console.WriteLine("这个月是您的最高月供月");
}
else
{
Console.WriteLine("这个月份并不是您的最高月供月");
}
}
else if (b == "等额本息")
{
Console.Write("待定");
}
else
{
Console.WriteLine("请输入正确的还款方式:");
}
}
if (a == "公积金贷款")
{
Console.WriteLine("请输入贷款金额(元):");
c = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("请输入贷款期限(月):");
d = Convert.ToDouble(Console.ReadLine());
q = c / d;
Console.WriteLine("请输入还款方式(等额本息or等额本金):");
b = Console.ReadLine();
if (b == "等额本金")
{
Console.WriteLine("您的期次为(就是贷款后的第几个月):");
x = Convert.ToInt32(Console.ReadLine());
s = (d + 1) * c * (m / 2);
e = c/d + (c - (x - 1) * q) * n;
Console.WriteLine("您本月还款金额为" + e + "元");
Console.WriteLine("您本月利息为" + (e - q) + "元");
//Console.WriteLine("您的累计归还总额为"e1+e2+……ex + "元");
Console.WriteLine("您的利息总和为" +s +"元");
Console.WriteLine("您的本利总和为" + (s+c) + "元");
Console.WriteLine("您本月月供为" + e+ "元");
Console.WriteLine("您的期次为" + x);
Console.WriteLine("您本月的偿还本息为" + e+"元");
Console.WriteLine("您本月的偿还利息为" + (e - q) + "元");
Console.WriteLine("您迄今为止偿还的本金为" + (x * q) + "元");
Console.WriteLine("您迄今为止尚未偿还的本金为" + (c - x * q) + "元");
if (x == 1)
{
Console.WriteLine("这个月是您的最高月供月");
}
else
{
Console.WriteLine("这个月份并不是您的最高月供月");
}
}
else if (b == "等额本息")
{
Console.Write("待定");
}
else
{
Console.WriteLine("请输入正确的还款方式:");
}
}
Console.ReadLine();
}