private void button3_Click(object sender, EventArgs e) { InterestCalculator calculatorObject; if (txtInterestType.Text == "Simple") { calculatorObject = new SimpleInterestCalculator(); calculatorObject.calculateInterest(); } else if (txtInterestType.Text == "Compound") { calculatorObject = new CompoundInterestCalculator(); calculatorObject.calculateInterest(); } else { MessageBox.Show("Correct choices are : Simple or Compound"); } }
private void button2_Click(object sender, EventArgs e) { InterestCalculator compObj = new CompoundInterestCalculator(); compObj.calculateInterest(); }