What Am I doing wrong? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

What Am I doing wrong?

kops147kops147 South AfricaPosts: 0Member

Hello,

I have created my own method which receives values from 2 spin edits but for some reason program is not compiling, when I am unable to call my procedure form the button.

Error messages I receive:
[dcc32 Error] Ass13.pas(50): E2066 Missing operator or semicolon
[dcc32 Error] Ass13.pas(50): E2003 Undeclared identifier: 'GramOff'
[dcc32 Error] Ass13.pas(51): E2003 Undeclared identifier: 'lblResults'
[dcc32 Error] Ass13.pas(51): E2066 Missing operator or semicolon
[dcc32 Hint] Ass13.pas(22): H2219 Private symbol 'GramsOff' declared but never used
[dcc32 Fatal Error] LstAss13.dpr(5): F2063 Could not compile used unit 'Ass13.pas'
Failed
Elapsed time: 00:00:02.2

Please see code below:

unit Ass13;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Samples.Spin,
Vcl.Buttons;

type
TfrmFee = class(TForm)
btnLoss: TButton;
sedCycle: TSpinEdit;
sedRun: TSpinEdit;
gpbLossResults: TGroupBox;
lblFee: TLabel;
Label1: TLabel;
Label2: TLabel;
BitBtn1: TBitBtn;
procedure btnLossClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
procedure GramsOff(HourRun, HourCycle : Integer; var GramOff : String);
public
{ Public declarations }
end;

var
frmFee: TfrmFee;

implementation

{$R *.dfm}

procedure TfrmFee.FormCreate(Sender: TObject);
begin

end;

procedure TfrmFee.GramsOff(HourRun, HourCycle : Integer; var GramOff : String);
Var
TotalCal, GramsLost : Integer;
Begin
HourRun := (sedRun.Value * 475);
HourCycle := (sedCycle.Value * 200);
TotalCal := (HourRun + HourCycle);
GramsLost := (TotalCal * 10 DIV 77);
GramOff := 'Weight loss: ' + IntToStr(GramsLost) + ' grams';
end; //proc CalcFee

procedure TfrmFee.btnLossClick(Sender: TObject);
var
HourRun, HourCycle : integer;
GramsOff : string; //Declare a local varicable FeeStr
begin
GramsOff (HourRun, HourCycle, GramOff);
lblResults.Caption := GramOff;

end;
end.

Sign In or Register to comment.