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"); } }
public override string DispenseKeys() { BaseState state = automat.NumberOfApartments <= 0 ? automat.FullyRentedState : automat.WaitingState; automat.SetState(state); return("Here are your keys"); }
public override string GotApplication() { automat.SetState(automat.GotApplicationState); return("Thanks for the Application"); }