今天要分享的是貸款金額的試算,這應該可以說是最基本的,哈哈~
這是初學時老師給的題目~
程式碼:
private void button1_Click(object sender, EventArgs e)
{
string a_t = textBox1.Text.ToString();
string b_t= textBox2.Text.ToString();
double c=double.Parse(textBox3.Text.ToString());
string d_t;
int a = int.Parse(a_t);
int b = int.Parse(b_t);
d_t = Convert.ToString(-(Financial.Pmt((c / 1200), b, a)));
MessageBox.Show("你的月算: " +d_t);
}
private void button2_Click(object sender, EventArgs e)
{
string a_t = textBox1.Text.ToString();
string b_t = textBox2.Text.ToString();
double c = double.Parse(textBox3.Text.ToString());
double d_t,f_t;
int a = int.Parse(a_t);
int b = int.Parse(b_t);
d_t =(-(Financial.Pmt((c / 1200), b, a)));
f_t = d_t * b;
MessageBox.Show("你的總算: " +f_t);
}
這邊用的計算功能是.Net裡的功能下去做的,如果想知道各函數的意思可以去物件瀏覽器裡找~