/// <summary> /// Checks the current state and matches it with silverste requiremnets /// </summary> /// <param name="bankAccount"></param> public override void StateChangeCheck(BankAccount bankAccount) { //Checks if balance is lower than the lower limit if (bankAccount.Balance < LowerLimit) { bankAccount.AccountStateId = BronzeState.GetInstance().AccountStateId; } //Checks if balance is more than upper limit if (bankAccount.Balance > this.UpperLimit) { bankAccount.AccountStateId = GoldState.GetInstance().AccountStateId; } }
/// <summary> /// Checks if the balance is greater than the upper limit - If so, change the state to gold /// Checks if the balance is less than the lower limit - If so, change the state to bronze /// </summary> /// <param name="bankAccount">Evaluates the bankAccount.Balance</param> public override void StateChangeCheck(BankAccount bankAccount) { if (!bankAccount.Description.Equals("Mortgage")) { if (bankAccount.Balance > UPPER_LIMIT) { bankAccount.AccountStateId = GoldState.GetInstance().AccountStateId; } else if (bankAccount.Balance < LOWER_LIMIT) { bankAccount.AccountStateId = BronzeState.GetInstance().AccountStateId; } } }