private void button1_Click(object sender, EventArgs e) { InterestCalculator.CalculateInterest cal = new InterestCalculator.CalculateInterest(); cal.Principalamount = Convert.ToDouble(txtPrintcipal.Text); cal.Interestrate = Convert.ToDouble(txtRate.Text); cal.NumberOfYears = Convert.ToDouble(txtTime.Text); MessageBox.Show("Interest: " + Convert.ToString(cal.Calculateinterest()) + "\n" + "Amount: " + Convert.ToString(cal.Calculateamount())); }
static void Main() { InterestCalculator.CalculateInterest simple = InterestCalculator.GetSimpleInterest; simple(2500, 7.2, 15); InterestCalculator.CalculateInterest compound = InterestCalculator.GetCompoundInterest; compound(500, 5.6, 10); }