Programm zur Darstellung eines Fahrkartenautomaten.
Passend zur Automatentheorie.
automaten.dfm
Alles anzeigen
automaten.pas [ausschnitt]
Alles anzeigen
Passend zur Automatentheorie.
automaten.dfm
Quellcode
- object WndTickets: TWndTickets
- Left = 861
- Top = 397
- ActiveControl = btn_Reset
- BorderIcons = [biSystemMenu, biMinimize]
- BorderStyle = bsSingle
- Caption = 'Fahrkarten'
- ClientHeight = 324
- ClientWidth = 246
- Color = clBtnFace
- Font.Charset = DEFAULT_CHARSET
- Font.Color = clWindowText
- Font.Height = -11
- Font.Name = 'MS Sans Serif'
- Font.Style = []
- OldCreateOrder = False
- Position = poDesktopCenter
- PixelsPerInch = 96
- TextHeight = 13
- object lbl_Caption: TLabel
- Left = 8
- Top = 4
- Width = 233
- Height = 24
- Alignment = taCenter
- AutoSize = False
- Caption = 'Fahrkartenautomat'
- Font.Charset = DEFAULT_CHARSET
- Font.Color = clNavy
- Font.Height = -19
- Font.Name = 'MS Sans Serif'
- Font.Style = []
- ParentFont = False
- end
- object grpbx_out: TGroupBox
- Left = 4
- Top = 212
- Width = 237
- Height = 105
- Caption = ' (3) Bitte entnehmen '
- TabOrder = 0
- object lbl_out: TLabel
- Left = 16
- Top = 34
- Width = 205
- Height = 21
- Alignment = taCenter
- AutoSize = False
- Caption = '< leer >'
- Font.Charset = DEFAULT_CHARSET
- Font.Color = clWindowText
- Font.Height = -16
- Font.Name = 'MS Sans Serif'
- Font.Style = []
- ParentFont = False
- end
- object btn_get: TButton
- Left = 4
- Top = 76
- Width = 229
- Height = 25
- Caption = 'Entnehmen'
- TabOrder = 0
- OnClick = btn_getClick
- end
- end
- object grpbx_cash: TGroupBox
- Left = 4
- Top = 32
- Width = 237
- Height = 89
- Caption = ' (1) Bitte Geld einwerfen ... '
- TabOrder = 1
- object lbl_in: TLabel
- Left = 116
- Top = 40
- Width = 89
- Height = 19
- Alignment = taCenter
- AutoSize = False
- Caption = '0,00 EUR'
- Font.Charset = ANSI_CHARSET
- Font.Color = clWindowText
- Font.Height = -16
- Font.Name = 'Tahoma'
- Font.Style = [fsBold]
- ParentFont = False
- end
- object btn_050: TButton
- Left = 5
- Top = 24
- Width = 75
- Height = 17
- Caption = '0,50 '#8364
- TabOrder = 0
- OnClick = btn_050Click
- end
- object btn_100: TButton
- Left = 5
- Top = 44
- Width = 75
- Height = 17
- Caption = '1,00 '#8364
- TabOrder = 1
- OnClick = btn_100Click
- end
- object btn_200: TButton
- Left = 5
- Top = 64
- Width = 75
- Height = 17
- Caption = '2,00 '#8364
- TabOrder = 2
- OnClick = btn_200Click
- end
- end
- object grpbx_Selection: TGroupBox
- Left = 4
- Top = 124
- Width = 237
- Height = 85
- Caption = ' (2) Bitte w'#228'hlen ... '
- TabOrder = 2
- object btn_short: TButton
- Left = 12
- Top = 20
- Width = 133
- Height = 25
- Caption = 'Kurzstrecke (1,00 '#8364')'
- TabOrder = 0
- OnClick = btn_shortClick
- end
- object btn_long: TButton
- Left = 12
- Top = 52
- Width = 133
- Height = 25
- Caption = 'Normaltarif (2,00 '#8364')'
- TabOrder = 1
- OnClick = btn_longClick
- end
- object btn_Reset: TButton
- Left = 156
- Top = 52
- Width = 75
- Height = 25
- Caption = 'R'#252'ckgabe'
- Default = True
- TabOrder = 2
- OnClick = btn_ResetClick
- end
- end
- end
automaten.pas [ausschnitt]
Quellcode
- type
- TWndTickets = class(TForm)
- lbl_Caption: TLabel;
- grpbx_out: TGroupBox;
- lbl_out: TLabel;
- grpbx_cash: TGroupBox;
- btn_050: TButton;
- btn_100: TButton;
- btn_200: TButton;
- lbl_in: TLabel;
- grpbx_Selection: TGroupBox;
- btn_short: TButton;
- btn_long: TButton;
- btn_Reset: TButton;
- btn_get: TButton;
- procedure btn_050Click(Sender: TObject);
- procedure btn_100Click(Sender: TObject);
- procedure btn_200Click(Sender: TObject);
- procedure btn_shortClick(Sender: TObject);
- procedure btn_longClick(Sender: TObject);
- procedure btn_ResetClick(Sender: TObject);
- procedure btn_getClick(Sender: TObject);
- private
- { Private-Deklarationen }
- _State : Word;
- //Zustandübergangsfunktion
- function func_Transition(IN_Input, IN_act_State: Word): Word;
- //Ausgabefunktion
- function func_Output(IN_Input, IN_act_State: Word): Word;
- //Arbeitstakt
- procedure SwitchTransition(IN_Input, IN_act_State: Word);
- //Hilfsfunktion zur Ausgabe des aktuellen Geldbetrags
- procedure ShowAmount;
- //Hilfsfunktion zur Anzeige der Ausgabe
- procedure ShowOutPut(IN_Output: Word);
- public
- { Public-Deklarationen }
- end;