Пример #1
0
        public void TestSiCiDemo1()
        {
            //Arrange
            I1 i2 = FactoryClass.GetSiCi(0);
            //Act
            float res = i2.Interest(40, 50, 20);

            //Assert
            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(100, res);
        }
Пример #2
0
        public void TestSiCiDemo()
        {
            //Arrange
            I1 i1 = FactoryClass.GetSiCi(0);

            //Act
            float  result  = i1.Interest(10, 20, 30);
            double result1 = i1.CalculateCompoundInterest(1000, 0.07, 1);

            //Assert
            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(60, result);
            Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(1070, result1);
        }
Пример #3
0
        static void Main(string[] args)
        {
            int   P, T;
            float R;

            Console.WriteLine("Enter All details to calculate Interest");
            Console.Write("Enter Amount :");
            P = Convert.ToInt32(Console.ReadLine());

            Console.Write("Enter Rate :");
            R = Convert.ToSingle(Console.ReadLine());
            Console.Write("Enter Time :");
            T = Convert.ToInt32(Console.ReadLine());

            //simpleInterest_CompoundInterestcalculation simpleInterest_CompoundInterestcalculation = new simpleInterest_CompoundInterestcalculation();
            I1 i1 = FactoryClass.GetSiCi(0);

            Console.WriteLine("Total Interest  is: {0}", i1.Interest(P, T, R));
            //float result=  i1.Interest(P, T, R);

            //calculatecompound Interest
            Console.WriteLine("Enter details to Calculate compound Interest");
            double amount;
            double interest;
            int    years;

            // double balance = 0;

            Console.Write("Enter the Amount:");
            amount = Convert.ToDouble(Console.ReadLine());

            Console.Write("Enter the Interest Rate:");
            interest = Convert.ToDouble(Console.ReadLine()) / 100;

            Console.Write("Enter number of Years:");
            years = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Total Amount Balance is: {0}", i1.CalculateCompoundInterest(amount, interest, years));
            Console.ReadLine();
        }