unit
Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 =
class
(TForm)
ListBox1: TListBox;
Button1: TButton;
Edit1: TEdit;
Label1: TLabel;
procedure
FormCreate(Sender: TObject);
procedure
Button1Click(Sender: TObject);
private
public
end
;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure
TForm1
.
FormCreate(Sender: TObject);
begin
ListBox1
.
itemindex:=
0
;
end
;
procedure
TForm1
.
Button1Click(Sender: TObject);
var
k:
integer
;
dlit, sum:
double
;
begin
case
ListBox1
.
Items
.
Indexof
0
: k:=
2
;
1
: k:=
3
;
2
: k:=
4
;
3
: k:=
5
;
4
: k:=
6
;
end
;
begin
dlit:= strtofloat(edit1
.
Text);
sum:=dlit*k;
end
;
ShowMessage(
'Ñòîèìîñòü ðàçãîâîðà'
+floattostr (sum));
end
;
end
.