diff options
Diffstat (limited to 'DesignPatterns/src/app/DesignPatterns.State/CardSwipedState.cs')
| -rw-r--r-- | DesignPatterns/src/app/DesignPatterns.State/CardSwipedState.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/DesignPatterns/src/app/DesignPatterns.State/CardSwipedState.cs b/DesignPatterns/src/app/DesignPatterns.State/CardSwipedState.cs new file mode 100644 index 0000000..ee3a24a --- /dev/null +++ b/DesignPatterns/src/app/DesignPatterns.State/CardSwipedState.cs @@ -0,0 +1,32 @@ +using System;
+
+namespace DesignPatterns.State {
+ public class CardSwipedState : IState {
+ public CardSwipedState( IPosTerminal terminal ) {
+ _terminal = terminal;
+ }
+
+ public void SwipeCard( string cardNumber ) {
+ Console.Out.WriteLine( "You already swiped a card" );
+ }
+
+ public void EnterAmount( double amount ) {
+ _terminal.Transaction.Amount = amount;
+ _terminal.CurrentState = new AmountEnteredState( _terminal );
+ }
+
+ public void EnterPin( string pin ) {
+ Console.Out.WriteLine( "You haven't swiped a card yet!" );
+ }
+
+ public void ProcessTransaction( ) {
+ Console.Out.WriteLine( "You haven't swiped a card yet!" );
+ }
+
+ public void PrintReceipt( ) {
+ Console.Out.WriteLine( "You haven't swiped a card yet!" );
+ }
+
+ private IPosTerminal _terminal;
+ }
+}
\ No newline at end of file |
