我需要制定一個程序,計算出您在工作時間內獲得的付款金額。 下面的代碼:德爾福:不兼容的類型:'整數'和'擴展'
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.
錯誤味精:
[Error] HoursWorked_u.pas(51): Incompatible types: 'Integer' and 'Extended'
請你注意:我是新手用戶的編碼一起,這是它的功課。 任何幫助將不勝感激! 在此先感謝!
在你最後一個問題上我說:*當你提出一個錯誤信息時,確保我們可以用你提供的代碼與消息中的行號結婚*請注意這個建議。 –