Exemplo n.º 1
0
 public String DispenseKeys()
 {
     if (_automat.Count <= 0)
     {
         _automat.SetState(_automat.GetFullyRentedState());
     }
     else
     {
         _automat.SetState(_automat.GetWaitingState());
     }
     return("Here are your keys!");
 }
Exemplo n.º 2
0
        public String CheckApplication()
        {
            var yesNo = _random.Next() % 10;

            if (yesNo > 4 && _automat.Count > 0)
            {
                _automat.SetState(_automat.GetApartmentRentedState());
                return("Congratulations, you were approved.");
            }
            else
            {
                _automat.SetState(_automat.GetWaitingState());
                return("Sorry, you were not approved.");
            }
        }