示例#1
0
        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");
            }
        }
示例#2
0
        private void button2_Click(object sender, EventArgs e)
        {
            InterestCalculator compObj = new CompoundInterestCalculator();

            compObj.calculateInterest();
        }