Delphi

 

ΕΦΑΡΜΟΓΗ ΥΠΟΛΟΓΙΣΜΟΥ ΚΑΤΑΝΑΛΩΣΗΣ ΗΛΕΚΤΡΙΚΩΝ ΣΥΣΚΕΥΩΝ.

 

 

unit electricity_consumption;
interface
uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Button1: TButton;
    Label5: TLabel;
    Label6: TLabel;
    Button2: TButton;
    Button3: TButton;
    Label7: TLabel;
    Label8: TLabel;
    Label9: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
   var
      Wa,Wh,h, sum, sum2 :String;
      Watt_int,Kwh_int,h_int:real;
  begin
     Wa :=edit1.Text;
     Wh :=edit2.Text;
     h  :=edit3.Text;
     Watt_int:=strTofloat(Wa);
     Kwh_int:=strTofloat(Wh);
     h_int:=strTofloat(h);
     sum:=floatTostr(((Watt_int*Kwh_int)/1000)*h_int);
     sum2:=floatTostr((Watt_int/1000)*h_int);
     Label5.caption:=sum;
     Label7.caption:=sum2;
     end;
procedure TForm1.Button2Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
    edit1.Text:=’ ‘ ;
    edit2.Text:=’ ‘ ;
    edit3.Text:=’ ‘ ;
    Label5.caption:=’ ‘;
    Label7.caption:=’ ‘;
end;
end.