public mainForm()
{
InitializeComponent();
}
string[,] summary = new string[10, 4];
private void exitButton_Click(object sender, EventArgs e)
{
this.Close();
}
private void calculateButton_Click(object sender, EventArgs e)
{
decimal monthlyInvestment =
Convert.ToDecimal (monthlyInvestmentTextBox.Text);
decimal yearlyInterestRate =
Convert.ToDecimal (interestRateTextBox.Text);
int years =
Convert.ToInt32(yearsTextBox.Text);
int months = years * 12;
decimal monthlyInterestRate = yearlyInterestRate / 12 / 100;
decimal futureValue = 0;
for (int i = 0; i < months; i++)
{
futureValue = (futureValue + monthlyInvestment)
* (1 + monthlyInterestRate);
}
futureValueTextBox.Text = futureValue.ToString("c");
monthlyInvestmentTextBox.Focus();
}
该程序根据利率和年份计算投资的未来价值。一旦用户点击计算,我希望程序在一个 10x4 的数组中存储多达 10 个计算。4 投资、利率、年限和未来价值。单击退出按钮后,我希望显示一个包含 10 个先前计算的消息框。我该怎么做呢?谢谢。