You've already forked lazarus-ccr
74 lines
1.4 KiB
ObjectPascal
74 lines
1.4 KiB
ObjectPascal
![]() |
unit KR21Unit;
|
||
|
|
||
|
{$mode objfpc}{$H+}
|
||
|
|
||
|
interface
|
||
|
|
||
|
uses
|
||
|
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
|
||
|
StdCtrls;
|
||
|
|
||
|
type
|
||
|
|
||
|
{ TKR21Frm }
|
||
|
|
||
|
TKR21Frm = class(TForm)
|
||
|
ResetBtn: TButton;
|
||
|
CancelBtn: TButton;
|
||
|
ComputeBtn: TButton;
|
||
|
ReturnBtn: TButton;
|
||
|
NoItemsEdit: TEdit;
|
||
|
MeanEdit: TEdit;
|
||
|
StdDevEdit: TEdit;
|
||
|
RelEdit: TEdit;
|
||
|
Label1: TLabel;
|
||
|
Label2: TLabel;
|
||
|
Label3: TLabel;
|
||
|
Label4: TLabel;
|
||
|
procedure ComputeBtnClick(Sender: TObject);
|
||
|
procedure FormShow(Sender: TObject);
|
||
|
procedure ResetBtnClick(Sender: TObject);
|
||
|
private
|
||
|
{ private declarations }
|
||
|
public
|
||
|
{ public declarations }
|
||
|
end;
|
||
|
|
||
|
var
|
||
|
KR21Frm: TKR21Frm;
|
||
|
|
||
|
implementation
|
||
|
|
||
|
{ TKR21Frm }
|
||
|
|
||
|
procedure TKR21Frm.ResetBtnClick(Sender: TObject);
|
||
|
begin
|
||
|
NoItemsEdit.Text := '';
|
||
|
MeanEdit.Text := '';
|
||
|
StdDevEdit.Text := '';
|
||
|
RelEdit.Text := '';
|
||
|
end;
|
||
|
|
||
|
procedure TKR21Frm.FormShow(Sender: TObject);
|
||
|
begin
|
||
|
ResetBtnClick(self);
|
||
|
end;
|
||
|
|
||
|
procedure TKR21Frm.ComputeBtnClick(Sender: TObject);
|
||
|
var
|
||
|
items, mean, stddev, rel : double;
|
||
|
begin
|
||
|
items := StrToFloat(NoItemsEdit.Text);
|
||
|
mean := StrToFloat(MeanEdit.Text);
|
||
|
stddev := StrToFloat(StdDevEdit.Text);
|
||
|
rel := (items / (items - 1.0)) * (1.0 - (mean * (items - mean))/
|
||
|
(items * sqr(stddev)));
|
||
|
RelEdit.Text := FloatToStr(rel);
|
||
|
end;
|
||
|
|
||
|
initialization
|
||
|
{$I kr21unit.lrs}
|
||
|
|
||
|
end.
|
||
|
|