unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

  const ceny:array[1..4] of integer=(500, 150,20,300);
type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    CheckBox4: TCheckBox;
    Label1: TLabel;
    procedure CheckBox1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  s:integer;
implementation

{$R *.dfm}

procedure TForm1.CheckBox1Click(Sender: TObject);
var cena: integer;
begin
  cena:=ceny[TCheckBox(Sender).Tag];
  if TCheckBox(Sender).Checked then s:=s+cena else s:=s-cena;
  Label1.Caption:='suma='+InttoStr(s);
end;

end.
