PECAHAN MATA UANG
procedure TKonversi.Button1Click(Sender: TObject);
var
masukkan,seratus_ribu,lima_puluh_ribu,sepuluh_puluh_ribu,
lima_ribu,seribu,lima_ratus,seratus,lima_puluh,sepuluh,satu:integer;
begin
{100 ribu}
masukkan:=StrToInt(edit1.Text);
seratus_ribu:=masukkan div 100000;
edit2.Text:=IntToStr(seratus_ribu);
{50 ribu}
masukkan:=StrToInt(edit1.Text);
lima_puluh_ribu:=masukkan div 50000 mod 2;
edit3.Text:=inttostr(lima_puluh_ribu);
{10 ribu}
masukkan:=StrToInt(edit1.Text);
sepuluh_puluh_ribu:=masukkan div 10000 mod 5;
edit4.Text:=inttostr(sepuluh_puluh_ribu);
{5 ribu}
masukkan:=StrToInt(edit1.Text);
Lima_ribu:=masukkan div 5000 mod 2;
edit5.Text:=inttostr(lima_ribu);
{seribu}
masukkan:=StrToInt(edit1.Text);
seribu:=masukkan div 1000 mod 5;
edit6.Text:=inttostr(seribu);
{lima ratus}
masukkan:=StrToInt(edit1.Text);
lima_ratus:=masukkan div 500 mod 2;
edit7.Text:=inttostr(lima_ratus);
{seratus}
masukkan:=StrToInt(edit1.Text);
seratus:=masukkan div 100 mod 5;
edit8.Text:=inttostr(seratus);
end;
procedure TKonversi.Button2Click(Sender: TObject);
begin
edit1.Text:=' ';
edit2.Text:=' ';
edit3.Text:=' ';
edit4.Text:=' ';
edit5.Text:=' ';
edit6.Text:=' ';
edit7.Text:=' ';
edit8.Text:=' ';
end;
KONVERSI SUHU
procedure TKonversi.Button3Click(Sender: TObject);
begin
if jenis_suhu=celcius then
begin
label11.Caption:='Fahrenheit';
label12.Caption:='Kelvin';
label13.Caption:='Reamur';
c:=strtofloat(edit9.Text);
edit10.Text:=floattostr((c*1.8)+32); //fahrenheit
edit11.Text:=floattostr(c+273.15); //kelvin
edit12.Text:=floattostr(c*0.8); //reamur
end
else
if jenis_suhu=fahrenheit then
begin
label11.Caption:='Celcius';
label12.Caption:='Kelvin';
label13.Caption:='Reamur';
f:=strtofloat(edit9.Text);
edit10.Text:=floattostr((f-32)/1.8); //celcius
edit11.Text:=floattostr((f+459.67)/1.8); //kelvin
edit12.Text:=floattostr((f-32)/2.25); //reamur
end
else
if jenis_suhu=kelvin then
begin
label11.Caption:='Celcius';
label12.Caption:='Fahrenheit';
label13.Caption:='Reamur';
k:=strtofloat(edit9.Text);
edit10.Text:=floattostr(k-273.15); //celcius
edit11.Text:=floattostr((k*1.8)-459.67); //fahrenheit
edit12.Text:=floattostr((k-273.15)*0.8); //reamur
end
else
if jenis_suhu=reamur then
begin
label11.Caption:='Celcius';
label12.Caption:='Fahrenheit';
label13.Caption:='Kelvin';
re:=strtofloat(edit9.Text);
edit10.Text:=floattostr(re/0.8); //celcius
edit11.Text:=floattostr((re*2.25)+32); //fahrenheit
edit12.Text:=floattostr((re/0.8)+273.15); //kelvin
end;
end;
procedure TKonversi.RadioButton1Click(Sender: TObject);
begin
jenis_suhu:=celcius;
end;
procedure TKonversi.RadioButton2Click(Sender: TObject);
begin
jenis_suhu:=fahrenheit;
end;
procedure TKonversi.RadioButton3Click(Sender: TObject);
begin
jenis_suhu:=kelvin;
end;
procedure TKonversi.RadioButton4Click(Sender: TObject);
begin
jenis_suhu:=reamur;
end;
procedure TKonversi.Button4Click(Sender: TObject);
begin
edit9.Text:=' ';
edit10.Text:=' ';
edit11.Text:=' ';
edit12.Text:=' ';
end;
procedure TKonversi.Button5Click(Sender: TObject);
begin
MainMenu.Show;
Konversi.Hide;
end;
end.
Sabtu, 19 November 2016
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar