static void Main(string[] args)
        {
            MembershipFactory memf = MembershipFactory.GetInstance();

            memf.CreateMembership("gold", 15, 5000);
            RegCustomer regc = new RegCustomer("1", "Kenneth", "*****@*****.**", "01/04/2015", memf.GetMembership("gold"));
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Company  company   = new Company();
            Customer customer1 = new Customer {
                CustomerId = 111, Email = "[email protected]", Name = "Cust1"
            };
            Customer customer2 = new Customer {
                CustomerId = 112, Email = "[email protected]", Name = "Cust2"
            };
            RegCustomer reg1 = new RegCustomer
            {
                CustomerId = 101,
                Name       = "Reg1",
                RegDate    = DateTime.Now.AddMonths(-1),
                Email      = "*****@*****.**",
                Membership = MembershipFactory.Instance.GetMembership("silver")
            };
            RegCustomer reg2 = new RegCustomer
            {
                CustomerId = 102,
                Name       = "Reg2",
                RegDate    = DateTime.Now.AddMonths(-2),
                Email      = "*****@*****.**",
                Membership = MembershipFactory.Instance.GetMembership("silver")
            };
            RegCustomer reg3 = new RegCustomer
            {
                CustomerId = 103,
                Name       = "Reg3",
                RegDate    = DateTime.Now.AddMonths(-1),
                Email      = "*****@*****.**",
                Membership = MembershipFactory.Instance.GetMembership("gold")
            };
            RegCustomer reg4 = new RegCustomer
            {
                CustomerId = 104,
                Name       = "Reg4",
                RegDate    = DateTime.Now.AddMonths(-1),
                Email      = "*****@*****.**",
                Membership = MembershipFactory.Instance.GetMembership("platinum")
            };

            company.Customers.Add(customer1);
            company.Customers.Add(customer2);
            company.Customers.Add(reg1);
            company.Customers.Add(reg2);
            company.Customers.Add(reg3);
            company.Customers.Add(reg4);
            Console.WriteLine("Total Customers: " + company.GetTotalCustomersCount());
            Console.WriteLine("Total Registered Customers: " + company.GetTotalRegCustomerCount());
            Console.WriteLine("Total Revenue: " + company.GetTotalFeeCollected());
        }
Exemple #3
0
        public double GetTotalFeeCollected()
        {
            double regAmount = 0;

            foreach (Customer cust in Customers)
            {
                if (cust is RegCustomer)
                {
                    RegCustomer rCust = (RegCustomer)cust;
                    regAmount += rCust.Membership.Fee;
                }
            }
            return(regAmount);
        }