I need to make a program that works out the amount you will get paid for the hours you worked. Here's the code:
unit HoursWorked_u;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Spin;
type
TForm1 = class(TForm)
lblName: TLabel;
edtName: TEdit;
Label1: TLabel;
sedHours: TSpinEdit;
btncalc: TButton;
Panel1: TPanel;
lblOutput: TLabel;
Label2: TLabel;
Panel2: TPanel;
lblOutPutMonth: TLabel;
labelrandom: TLabel;
Label3: TLabel;
seddays: TSpinEdit;
procedure btncalcClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
// sedHours and sedDays are SpinEdits
// Rand (R) is South African currency eg: One months work, I will recieve-
// -R10 000.00
// Where R12,50 is paid an hour.
// Need to work out how much I will get paid for how many hours are worked.
procedure TForm1.btncalcClick(Sender: TObject);
var
sName :string;
iHours, iDays :integer;
rPay :real;
begin
rPay := 12.5;
sName := edtName.Text;
iHours := sedHours.value * rPay;
iDays := sedDays.value * iHours;
lblOutput.caption := sName + ' You will recieve R' + IntToStr (iHours);
lblOutputMonth.Caption := 'You will recive R' + intToStr (iDays);
end;
end.
The error msg is:
[Error] HoursWorked_u.pas(51): Incompatible types: 'Integer' and 'Extended'
Please do note: I am a novice user at coding all together and this is IT homework. Any help would be much appreciated! Thanks in advance!