示例#1
0
 public bool SelectSoda(AbstractSoda soda)
 {
     if (_sodaMachine.CurrentBalance > 0)
     {
         _sodaMachine.CurrentState = _sodaMachine.SelectSodaState;
         _sodaMachine.CurrentState.SelectSoda(soda);
     }
     Console.WriteLine("First you have to add some money");
     return(false);
 }
示例#2
0
 public bool SelectSoda(AbstractSoda soda)
 {
     if (_sodaMachine.ListOfSodas.Contains(soda))
     {
         _sodaMachine.FoundSoda    = soda;
         _sodaMachine.CurrentState = _sodaMachine.ReleaseSodaState;
         _sodaMachine.CurrentState.ReleaseSoda();
         return(true);
     }
     else
     {
         Console.WriteLine("No such item in our vending machine");
         return(false);
     }
 }
示例#3
0
 public bool SelectSoda(AbstractSoda soda)
 {
     Console.WriteLine("Invalid Operation");
     return(false);
 }