You are on page 1of 3

var

r1,r2,r3,rt : real;
begin
r1 := strtofloat (edit2.Text);
r2 := strtofloat (edit3.Text);
r3 := strtofloat (edit4.Text);
if ( combobox1.text='1') then
begin
rt := r1+r2+r3;
edit5.Text := floattostr(rt);
end
else if (combobox1.text='2') then
begin
rt := (r1*r2*r3)/((r1*r2)+(r2*r3)+(r1*r3));
edit5.Text := floattostr(rt);
end
else
begin
rt := r1 + ((r2*r3)/(r2+r3));
edit5.Text := floattostr(rt);
end
end;
procedure TForm1.ComboBox1Change(Sender: TObject);
begin
if( combobox1.text='1') then
begin
edit2.text := ' ';
edit3.text := ' ';
edit4.text := ' ';
edit5.text := ' ';
combobox1.text :=' ';
form1.Color := clsilver;
label5.Font.color := clred;
label6.Font.color := clblue;
label7.Font.color := clgreen;
label8.Font.color := clyellow;
label1.Font.color := clWHITE;
label2.Font.color := clWHITE;
label3.Font.color := clwhite;
label4.Font.color := clwhite;
label9.Font.color := clblack;
label9.caption := 'MENGHITUNG RESISTOR SERI';
end
else if( combobox1.text='2') then
begin
edit2.text := ' ';
edit3.text := ' ';
edit4.text := ' ';
edit5.text := ' ';
combobox1.text :=' ';
form1.Color := clskyblue;
label5.Font.color := clred;
label6.Font.color := clblue;
label7.Font.color := clgreen;
label8.Font.color := clyellow;
label1.Font.color := clWHITE;
label2.Font.color := clWHITE;
label3.Font.color := clwhite;
label4.Font.color := clwhite;
label9.Font.color := clblack;
label9.caption := 'MENGHITUNG RESISTOR PARALEL';
end
else if( combobox1.text='3') then
begin
edit2.text := ' ';
edit3.text := ' ';
edit4.text := ' ';
edit5.text := ' ';
form1.Color := clmoneygreen;
label5.Font.color := clblue;
label6.Font.color := clred;
label7.Font.color := clgreen;
label8.Font.color := clyellow;
label1.Font.color := clWHITE;
label2.Font.color := clWHITE;
label3.Font.color := clwhite;
label4.Font.color := clwhite;
label9.Font.color := clblack;
label9.caption := 'MENGHITUNG RESISTOR CAMPURAN';
end
else
begin
form1.color := clblack;
combobox1.Color := clblack;
edit2.color := clblack;
edit3.color := clblack;
edit4.color := clblack;
edit5.color := clblack;
label5.Font.color := clwhite;
label6.Font.color := clwhite;
label7.Font.color := clwhite;
label8.Font.color := clwhite;
label9.Font.color := clwhite;
Application.MessageBox('maaf, pilihan yang anda masukan SALAH!', 'Informasi',
MB_OK or
MB_ICONEXCLAMATION);
end
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
edit2.text := ' ';
edit3.text := ' ';
edit4.text := ' ';
edit5.text := ' ';
combobox1.text :='--pilihan--';
edit2.color := clwhite;
edit3.color := clwhite;
edit4.color := clwhite;
edit5.color := clwhite;
combobox1.color := clwhite;
form1.Color := clbtnface;
label5.Font.color := clblack;
label6.Font.color := clblack;
label7.Font.color := clblack;
label8.Font.color := clblack;
label1.Font.color := clblack;
label2.Font.color := clblack;
label3.Font.color := clblack;
label4.Font.color := clblack;
label9.Font.color := clblack;