Aplikasi Sederhana -- Meghitung Nilai MHS
procedure TForm1.Button1Click(Sender: TObject);
var n1, n2, n3, n4, na : real;
begin
n1 := StrToFloat(Edit3.Text);
n2 := StrToFloat(Edit4.Text);
n3 := StrToFloat(Edit5.Text);
n4 := StrToFloat(Edit6.Text);
na := 0.5 * (n1 + n2) / 2 + 0.2 * n3 + 0.3 * n4;
edit7.Text := floatTostr(na);
if na >= 80 then
edit8.Text :='A'
else if na >= 65 then
edit8.Text :='B'
else if na >= 50 then
edit8.Text :='C'
else if na >= 40 then
edit8.Text :='D'
else
Edit8.Text :='E'
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
application.Terminate
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Edit1.text := '';
Edit2.text := '';
Edit3.text := '';
Edit4.text := '';
Edit5.text := '';
Edit6.text := '';
Edit7.text := '';
Edit8.text := '';
edit1.setFocus
end;
procedure TForm1.Button1Click(Sender: TObject);
var n1, n2, n3, n4, na : real;
begin
n1 := StrToFloat(Edit3.Text);
n2 := StrToFloat(Edit4.Text);
n3 := StrToFloat(Edit5.Text);
n4 := StrToFloat(Edit6.Text);
na := 0.5 * (n1 + n2) / 2 + 0.2 * n3 + 0.3 * n4;
edit7.Text := floatTostr(na);
if na >= 80 then
edit8.Text :='A'
else if na >= 65 then
edit8.Text :='B'
else if na >= 50 then
edit8.Text :='C'
else if na >= 40 then
edit8.Text :='D'
else
Edit8.Text :='E'
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
application.Terminate
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Edit1.text := '';
Edit2.text := '';
Edit3.text := '';
Edit4.text := '';
Edit5.text := '';
Edit6.text := '';
Edit7.text := '';
Edit8.text := '';
edit1.setFocus
end;
Tidak ada komentar:
Posting Komentar