Howdy, Stranger!

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

Categories

Problem

jvosjvos Member Posts: 10
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.


Please help, kind regards


Comments

  • zibadianzibadian Member Posts: 6,349
    : 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.
    :
    :
    : Please help, kind regards
    :
    :
    [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]


Sign In or Register to comment.