Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Customer         customer1 = new Customer("James", "Stuart", "0045504239", "Banker", 60000M, 0.6, 5);
            Customer         customer2 = new Customer("Erhabor", "Pamela", "4356937898", "Coder", 60400M, 0.8, 3);
            Customer         customer3 = new Customer("Samuel", "Bankole", "7755479799", "Teacher", 50000M, 0.4, 4);
            Customer         customer4 = new Customer("Samuel", "Olugbemi", "0069404239", "Programmer", 1000000M, 0.8, 7);
            IList <Customer> customers = new List <Customer>()
            {
                customer1, customer2, customer3, customer4
            };
            Interest        interest            = new Interest(customers);
            InterestDel     simpleinterestDel   = interest.SimpleInterest;
            InterestDel     compoundInterestDel = interest.CompoundInterest;
            IList <decimal> simpleInterests     = simpleinterestDel();
            IList <decimal> compoundInterests   = compoundInterestDel();

            // foreach (var item in simpleInterests)
            // {
            //     Console.WriteLine($"{item:C}");
            // }
            // Console.WriteLine();
            // foreach (var item in compoundInterests)
            // {
            //     Console.WriteLine($"{item:C}");
            // }
            for (int i = 0; i < customers.Count; i++)
            {
                Console.WriteLine($"{customers[i]}\nSimple Interest: {simpleInterests[i]:C}\nCompound Interest: {compoundInterests[i]:C}\n");
            }
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            CompounSimple simple1 = new CompounSimple("James Stuart", "James stuart Avenu", 1000m, 10, 0.05);
            CompounSimple simple2 = new CompounSimple("James Stuart", "James stuart Avenu", 2000m, 20, 0.01);

            object[][] customer = { new object[] { simple1.Name, simple1.Address, simple1.Principal, simple1.Time, simple1.Rate }, new object[] { simple2.Name, simple2.Address, simple2.Principal, simple2.Time, simple2.Rate } };


            Console.WriteLine("Looping Over Customers Details\n__________________");
            int count = 0;

            for (int i = 0; i < customer.Length; i++)
            {
                count++;
                for (int k = 0; k < customer[i].Length; k++)
                {
                    Console.WriteLine($"{customer[i][k], 3}");
                }
                Console.WriteLine();
                Console.WriteLine(" First Customers Interest\n_______________________________");
                InterestDel interest1 = SimpleInterest;
                interest1 += CompoundInterest;
                interest1((decimal)customer[i][2], (int)customer[i][3], (double)customer[i][4]);
                Console.WriteLine();
            }



            // Console.WriteLine(" Second Customers Interest\n________________________________");
            // InterestDel interest2 = SimpleInterest;
            // interest2 +=CompoundInterest;
            // interest2((decimal)customer[i][2], (double)customer[i][3], (int)customer[i][4]);
        }