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