//JS Hardware-Rechner 1.1
unit JSUnit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, jpeg;
type
TForm1 =
class(TForm)
EdtU: TEdit;
EdtR: TEdit;
EdtI: TEdit;
BtnU: TButton;
BtnR: TButton;
BtnI: TButton;
GroupBox1: TGroupBox;
Lf: TLabel;
GroupBox2: TGroupBox;
GroupBox3: TGroupBox;
GroupBox4: TGroupBox;
GroupBox5: TGroupBox;
GroupBox6: TGroupBox;
Image1: TImage;
ER1: TEdit;
ER2: TEdit;
EU1: TEdit;
EU2: TEdit;
E2U: TEdit;
I: TEdit;
CR1: TCheckBox;
CR2: TCheckBox;
Cu1: TCheckBox;
CU2: TCheckBox;
CU: TCheckBox;
CheckBox6: TCheckBox;
GroupBox7: TGroupBox;
GroupBox8: TGroupBox;
GroupBox9: TGroupBox;
BtnP: TButton;
GroupBox11: TGroupBox;
EdtP: TEdit;
GroupBox12: TGroupBox;
EdtW: TEdit;
BtnDel: TButton;
GroupBox10: TGroupBox;
EdtT: TEdit;
BtnT: TButton;
BtnW: TButton;
GroupBox13: TGroupBox;
EdtPreis: TEdit;
BtnPreis: TButton;
BtnGeb: TButton;
GroupBox14: TGroupBox;
EdtGeb: TEdit;
LblErg: TLabel;
procedure Balle(Sender: TObject);
procedure Keyalle(Sender: TObject;
var Key: Char);
procedure BReiheClick(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
y : real;
implementation
{$R *.dfm}
procedure TForm1.Balle(Sender: TObject);
begin
if sender = btnu
then
begin
y := (strTofloat(edtr.text) * strTofloat(edti.text)) ;
EdtU.text := FloatToStrF(y,ffnumber,12,2);[b]
lf.Caption := '
U = R * I' ;
end;
if sender = btnr
then
begin
y := strTofloat(edtu.text) / strTofloat(edti.text);
[/b] edtr.text := FloatToStrF(y,ffnumber,12,2);
lf.Caption := '
R = U / I';
end;
if sender = btni
then
begin
lf.Caption := '
I = U / R' ;
y := (strTofloat(edtu.text) / strTofloat(edtr.text));
edti.text := FloatToStrF(y,ffnumber,12,2);
end;
if sender = BtnP
then
begin
y := (strTofloat(edtu.text) * strTofloat(edti.text));
edtP.text := FloatToStrF(y,ffnumber,12,2);
lf.Caption := '
P = U * I' ;
end;
if sender = BtnT
then
begin
y := (Strtofloat(edtW.text)/(strTofloat(edtP.text))*1000);
edtT.text := FloatToStrF(y,ffnumber,12,2);
lf.Caption := '
t = W / P' ;
end;
if sender = BtnW
then
begin
y := (strTofloat(edtP.text) * strTofloat(edtT.text))/1000;
edtW.text := FloatToStrF(y,ffnumber,12,2);
lf.Caption := '
W = P * t' ;
end;
if sender = BtnPreis
then
begin
[size=18][b] y := (strTofloat(edtGeb.text) / strTofloat(edtW.text)*100);[/b][/size]
edtPreis.text := FloatToStrF(y,ffnumber,12,2);
lf.Caption := '
xxx';
end;
if sender = BtnGeb
then
begin
y := (strTofloat(edtPreis.text) * strTofloat(edtW.text)/100);
[size=18] [b] edtGeb.text := FloatToStrF(y,ffcurrency,12,2);[/b][/size]
lf.Caption := '
Gebühren = Preis * W' ;
end;
if sender = BtnDel
then
begin
EdtU.text := #0;
EdtR.Text := #0;
EdtI.text := #0;
EdtP.Text := #0;
EdtU.text := #0;
end;
end;
procedure TForm1.Keyalle(Sender: TObject;
var Key: Char);
begin
If not (Key
in['
0'..'
9',#8,#44])
then Key := #0;
end;
procedure TForm1.BReiheClick(Sender: TObject);
begin
if sender = cr2
then er2.text := FloatToStr(strTofloat(er1.text) * strTofloat(eu2.text) / strTofloat(eu1.text));
if sender = cr1
then er1.text := FloatToStr(strTofloat(er2.text) * strTofloat(eu1.text) / strTofloat(eu2.text)) ;
if sender = cu1
then eu1.text := FloatToStr(strTofloat(er1.text) * strTofloat(eu2.text) / strTofloat(er2.text)) ;
if sender = cu2
then eu2.text := FloatToStr(strTofloat(er2.text) * strTofloat(eu1.text) / strTofloat(er1.text)) ;
end;
end.