unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls;
type
TForm2 =
class(TForm)
RGGender: TRadioGroup;
LHeight: TLabel;
LWeight: TLabel;
EHeight: TEdit;
EWeight: TEdit;
BAnswer: TButton;
BEnd: TButton;
procedure BAnswerClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
IdealHigh: Real;
IdealLow: Real;
implementation
{$R *.dfm}
procedure TForm2.BAnswerClick(Sender: TObject);
begin
if RGGender.ItemIndex = 0
then
begin
IdealHigh:= StrToFloat(EHeight.Text) - 100;
IdealHigh:= IdealHigh * 0.97;
IdealLow:= StrToFloat(EHeight.Text) - 100;
IdealLow:= IdealLow * 0.93;
if IdealHigh < StrToFloat(EWeight.Text)
then
ShowMessage ('
Sie haben Übergewicht!')
else if IdealLow > StrToFloat(EWeight.Text)
then
ShowMessage ('
Sie haben Untergewicht!')
else
ShowMessage ('
Sie haben Idealgewicht!');
end
else if RGGender.ItemIndex = 1
then
begin
IdealHigh:= StrToFloat(EHeight.Text) - 100;
IdealHigh:= IdealHigh * 0.92;
IdealLow:= StrToFloat(EHeight.Text) - 100;
IdealLow:= IdealLow * 0.88;
if IdealHigh < StrToFloat(EWeight.Text)
then
ShowMessage ('
Sie haben Übergewicht!')
else if IdealLow > StrToFloat(EWeight.Text)
then
ShowMessage ('
Sie haben Untergewicht!')
else
ShowMessage ('
Sie haben Idealgewicht!');
end
end;
end.