代码如下:
private void button1_Click(object sender, EventArgs e)
{
//月利率,年利率,贷款本金,每月还款额,首付,总价,单价,面积,首付比例
float r, r1, benjin, meiyue, sf, zj, dj, mj, bl;
//还款期数
int months;
r1 = 0.05f;
bl = 0.3f;
dj = float.Parse(textBox1.Text);
mj = float.Parse(textBox2.Text);
months = int.Parse(textBox3.Text);
zj = dj * mj;
sf = zj * bl;
benjin = zj - sf;
r = r1 / 12;
meiyue = (float)(benjin * r * Math.Pow(1 + r, months) / (Math.Pow(1 + r, months) - 1));
MessageBox.Show("您看中的房子至少需要首付:" + sf + "元\n剩余" + benjin + "元,全部贷款" + months + "个月,按年利率" + r1 + "计算,每月需还银行" + meiyue + "元");
}
网友评论