예제 #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 button1_Click(object sender, EventArgs e)
        {
            InterestCalculator simpleObj = new SimpleInterestCalculator();

            simpleObj.calculateInterest();
        }