예제 #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");
            }
        }
예제 #2
0
        public override string DispenseKeys()
        {
            BaseState state = automat.NumberOfApartments <= 0 ? automat.FullyRentedState : automat.WaitingState;

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