Delphi Fahrkartenautomat

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Delphi Fahrkartenautomat

    Programm zur Darstellung eines Fahrkartenautomaten.
    Passend zur Automatentheorie.

    automaten.dfm

    Quellcode

    1. object WndTickets: TWndTickets
    2. Left = 861
    3. Top = 397
    4. ActiveControl = btn_Reset
    5. BorderIcons = [biSystemMenu, biMinimize]
    6. BorderStyle = bsSingle
    7. Caption = 'Fahrkarten'
    8. ClientHeight = 324
    9. ClientWidth = 246
    10. Color = clBtnFace
    11. Font.Charset = DEFAULT_CHARSET
    12. Font.Color = clWindowText
    13. Font.Height = -11
    14. Font.Name = 'MS Sans Serif'
    15. Font.Style = []
    16. OldCreateOrder = False
    17. Position = poDesktopCenter
    18. PixelsPerInch = 96
    19. TextHeight = 13
    20. object lbl_Caption: TLabel
    21. Left = 8
    22. Top = 4
    23. Width = 233
    24. Height = 24
    25. Alignment = taCenter
    26. AutoSize = False
    27. Caption = 'Fahrkartenautomat'
    28. Font.Charset = DEFAULT_CHARSET
    29. Font.Color = clNavy
    30. Font.Height = -19
    31. Font.Name = 'MS Sans Serif'
    32. Font.Style = []
    33. ParentFont = False
    34. end
    35. object grpbx_out: TGroupBox
    36. Left = 4
    37. Top = 212
    38. Width = 237
    39. Height = 105
    40. Caption = ' (3) Bitte entnehmen '
    41. TabOrder = 0
    42. object lbl_out: TLabel
    43. Left = 16
    44. Top = 34
    45. Width = 205
    46. Height = 21
    47. Alignment = taCenter
    48. AutoSize = False
    49. Caption = '< leer >'
    50. Font.Charset = DEFAULT_CHARSET
    51. Font.Color = clWindowText
    52. Font.Height = -16
    53. Font.Name = 'MS Sans Serif'
    54. Font.Style = []
    55. ParentFont = False
    56. end
    57. object btn_get: TButton
    58. Left = 4
    59. Top = 76
    60. Width = 229
    61. Height = 25
    62. Caption = 'Entnehmen'
    63. TabOrder = 0
    64. OnClick = btn_getClick
    65. end
    66. end
    67. object grpbx_cash: TGroupBox
    68. Left = 4
    69. Top = 32
    70. Width = 237
    71. Height = 89
    72. Caption = ' (1) Bitte Geld einwerfen ... '
    73. TabOrder = 1
    74. object lbl_in: TLabel
    75. Left = 116
    76. Top = 40
    77. Width = 89
    78. Height = 19
    79. Alignment = taCenter
    80. AutoSize = False
    81. Caption = '0,00 EUR'
    82. Font.Charset = ANSI_CHARSET
    83. Font.Color = clWindowText
    84. Font.Height = -16
    85. Font.Name = 'Tahoma'
    86. Font.Style = [fsBold]
    87. ParentFont = False
    88. end
    89. object btn_050: TButton
    90. Left = 5
    91. Top = 24
    92. Width = 75
    93. Height = 17
    94. Caption = '0,50 '#8364
    95. TabOrder = 0
    96. OnClick = btn_050Click
    97. end
    98. object btn_100: TButton
    99. Left = 5
    100. Top = 44
    101. Width = 75
    102. Height = 17
    103. Caption = '1,00 '#8364
    104. TabOrder = 1
    105. OnClick = btn_100Click
    106. end
    107. object btn_200: TButton
    108. Left = 5
    109. Top = 64
    110. Width = 75
    111. Height = 17
    112. Caption = '2,00 '#8364
    113. TabOrder = 2
    114. OnClick = btn_200Click
    115. end
    116. end
    117. object grpbx_Selection: TGroupBox
    118. Left = 4
    119. Top = 124
    120. Width = 237
    121. Height = 85
    122. Caption = ' (2) Bitte w'#228'hlen ... '
    123. TabOrder = 2
    124. object btn_short: TButton
    125. Left = 12
    126. Top = 20
    127. Width = 133
    128. Height = 25
    129. Caption = 'Kurzstrecke (1,00 '#8364')'
    130. TabOrder = 0
    131. OnClick = btn_shortClick
    132. end
    133. object btn_long: TButton
    134. Left = 12
    135. Top = 52
    136. Width = 133
    137. Height = 25
    138. Caption = 'Normaltarif (2,00 '#8364')'
    139. TabOrder = 1
    140. OnClick = btn_longClick
    141. end
    142. object btn_Reset: TButton
    143. Left = 156
    144. Top = 52
    145. Width = 75
    146. Height = 25
    147. Caption = 'R'#252'ckgabe'
    148. Default = True
    149. TabOrder = 2
    150. OnClick = btn_ResetClick
    151. end
    152. end
    153. end
    Alles anzeigen


    automaten.pas [ausschnitt]

    Quellcode

    1. type
    2. TWndTickets = class(TForm)
    3. lbl_Caption: TLabel;
    4. grpbx_out: TGroupBox;
    5. lbl_out: TLabel;
    6. grpbx_cash: TGroupBox;
    7. btn_050: TButton;
    8. btn_100: TButton;
    9. btn_200: TButton;
    10. lbl_in: TLabel;
    11. grpbx_Selection: TGroupBox;
    12. btn_short: TButton;
    13. btn_long: TButton;
    14. btn_Reset: TButton;
    15. btn_get: TButton;
    16. procedure btn_050Click(Sender: TObject);
    17. procedure btn_100Click(Sender: TObject);
    18. procedure btn_200Click(Sender: TObject);
    19. procedure btn_shortClick(Sender: TObject);
    20. procedure btn_longClick(Sender: TObject);
    21. procedure btn_ResetClick(Sender: TObject);
    22. procedure btn_getClick(Sender: TObject);
    23. private
    24. { Private-Deklarationen }
    25. _State : Word;
    26. //Zustandübergangsfunktion
    27. function func_Transition(IN_Input, IN_act_State: Word): Word;
    28. //Ausgabefunktion
    29. function func_Output(IN_Input, IN_act_State: Word): Word;
    30. //Arbeitstakt
    31. procedure SwitchTransition(IN_Input, IN_act_State: Word);
    32. //Hilfsfunktion zur Ausgabe des aktuellen Geldbetrags
    33. procedure ShowAmount;
    34. //Hilfsfunktion zur Anzeige der Ausgabe
    35. procedure ShowOutPut(IN_Output: Word);
    36. public
    37. { Public-Deklarationen }
    38. end;
    Alles anzeigen
    Dateien