Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
any type of a formula that has been used to write a program
I only need it to understand how to build up a program for calculating a formula by using Delphi.
OnClick event:
var
theanswer : float
begin
theanswer = (2 * StrToInt(EdNumber1.Text))/(3 * StrToInt(EdNumber2.Text));//may need to use div here instead of /
lblAnswer.Caption := floattostr(theanswer)
lblanswer.Visible := True;
end;
function TfrmReviewforPayment.CalculateTotalMiles(AJuror : string; JurorMiles : integer; IsPE : boolean) : double;
var
TripsMade : integer;
begin
//the query I'm working with
with dmJMS.qryCalculateHours do
begin
//clear and replace the SQL in the query
SQL.Clear;
SQL.Add('SELECT * FROM JMPNEWHOUR WHERE JURNUM = ' + AJuror + ' ORDER BY SERVDAT');
Active := True;
//check if there are any records in the result set
if not isempty then
begin
TripsMade := 0;
{loop through the recordset and count the number of records(depending on your database you may be able to use the RecordCount property. The database I'm using doesn't allow this property.}
while not eof do
begin
//add one to TripsMade each time
inc(TripsMade);
Next;
end;
//special conditions for PublicEmployees (PE)
if not IsPE then
Result := JurorMiles * TripsMade
else begin
if JurorMiles >= 30 then
Result := JurorMiles * TripsMade
else
Result := 0;
end;
end
else
Result := 0;
end;
end;