Problem

procedure TfrmBurnCal.btnLossClick(Sender: Tobject);
var
TotalCal, GramsLost : integer;
begin
TotalCal := (sedCycle.value * 200) +
(sedRun.value * 475);
GramsLost := TotalCal * 10 div 77;
lblLoss.Caption := 'Weight loss: ' + IntToStr(GramsLost)+ ' grams';

How do I write a function here for my prog that accpets the hours cycling and/or running that calculates the number of grams lost.

• : procedure TfrmBurnCal.btnLossClick(Sender: Tobject);
: var
: TotalCal, GramsLost : integer;
: begin
: TotalCal := (sedCycle.value * 200) +
: (sedRun.value * 475);
: GramsLost := TotalCal * 10 div 77;
: lblLoss.Caption := 'Weight loss: ' + IntToStr(GramsLost)+ ' grams';
:
: How do I write a function here for my prog that accpets the hours cycling and/or running that calculates the number of grams lost.
:
:
:
:
[code]
function CalcGramsLost(Cycle, Run: integer): integer
begin
// Perform calculation
end;

procedure TfrmBurnCal.btnLossClick(Sender: Tobject);
begin
lblLoss.Caption := 'Weight loss: ' + IntToStr(
CalcGramsLost(sedCycle.value, sedRun.value)
)+ ' grams';
end;
[/code]