Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Interest si;

            Console.Write("Enter the priciple: ");
            double principle = double.Parse(Console.ReadLine());

            Console.Write("Enter the rate: ");
            double rate = double.Parse(Console.ReadLine());

            Console.Write("Enter the years: ");
            int years = int.Parse(Console.ReadLine());

            Console.WriteLine("Choose the Option...\n 1.Simple Interest\t2.Coumpound Interst");
            int choice = int.Parse(Console.ReadLine());

            if (choice == 1)
            {
                si = new SimpleInterest();
                si.CalculateInterest(principle, rate, years);
            }
            else if (choice == 2)
            {
                si = new CompoundInterest();
                si.CalculateInterest(principle, rate, years);
            }
            else
            {
                Console.WriteLine("Wrong Choice");
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Interest interest = new SimpleInterest();

            interest.CalculateInterest(1000, 5, 6);
            Interest interest2 = new CompoundInterest();

            interest2.CalculateInterest(1111, 2, 5);
        }