Esempio n. 1
0
        public CurrentAccount(TypeEnum type, Person owner) : base(owner)
        {
            if (owner.GetType() == typeof(PhysicalPerson))
            {
                owner = new PhysicalPerson();
            }
            else if (owner.GetType() == typeof(LegalPerson))
            {
                owner = new LegalPerson();
            }

            if (type.Equals(TypeEnum.SPECIAL))
            {
                if (owner.Income > 5000 || owner.Revenues > 5000)
                {
                    this.Type      = type;
                    this.Limit     = (owner.Income * 2.5) || ((owner.Revenues * 2.5));
                    this.LimitRate = 0.02;
                }
                else
                {
                    Console.WriteLine("You should have Income or Revenues great than R$5.000,00!");
                }
            }
            else if (type.Equals(TypeEnum.SIMPLE))
            {
                this.Type      = type;
                this.Limit     = (owner.Income * 1.5) || ((owner.Revenues * 1.5));
                this.LimitRate = 0.05;
            }
            else
            {
                Console.WriteLine("The account type should be SIMPLE or SPECIAL!");
            }
        }