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 button1_Click(object sender, EventArgs e) { InterestCalculator simpleObj = new SimpleInterestCalculator(); simpleObj.calculateInterest(); }