Exemplo n.º 1
0
        public override string CheckApplication()
        {
            bool isApproved = (new Random(DateTime.Now.Millisecond).Next() % 10) > 4;

            if (isApproved && automat.NumberOfApartments > 0)
            {
                automat.SetState(automat.ApartmentRentedState);
                return("Congratulation, you were approved.");
            }
            else
            {
                automat.SetState(automat.WaitingState);
                return("Sorry, you were not approved");
            }
        }
Exemplo n.º 2
0
        public override string DispenseKeys()
        {
            BaseState state = automat.NumberOfApartments <= 0 ? automat.FullyRentedState : automat.WaitingState;

            automat.SetState(state);
            return("Here are your keys");
        }
Exemplo n.º 3
0
 public override string GotApplication()
 {
     automat.SetState(automat.GotApplicationState);
     return("Thanks for the Application");
 }