TUGAS PRAKTIKUM
PEMROGRAMAN VISUAL
MODUL 5
soal : Buatlah Sebuah form seperti
gambar dibawah ini..
JAWAB :
- Tampilan Design awal :
- Kode Program untuk button PROSES:
private void
jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
int
a,b,c,d,e;
a =
Integer.parseInt(tabsen.getText());
b =
Integer.parseInt(ttugas.getText());
c =
Integer.parseInt(tuts.getText());
d =
Integer.parseInt(tuas.getText());
e =((a
* 10/100) + (b * 20/100) + (c * 30/100) + (d * 40/100));
tangka.setText(Integer.toString(e));
if (e
>= 80 && e <=100){
thuruf.setText("A");
tket.setText("SANGAT MEMUASKAN");
}else{
if
(e >= 70 && e <= 79){
thuruf.setText("B");
tket.setText("MEMUASKAN");
}else{
if
(e >= 60 && e <= 69){
thuruf.setText("C");
tket.setText("CUKUP");
}else{
if (e >= 50 && e <= 59){
thuruf.setText("D");
tket.setText("");
}else{
thuruf.setText("B");
tket.setText("MEMUASKAN");
}
}
}
}
}
- Kode Program untuk Button CLEAR :
private void
jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
tnim.setText("");
tnama.setText("");
tabsen.setText("");
ttugas.setText("");
tuts.setText("");
tuas.setText("");
tangka.setText("");
thuruf.setText("");
tket.setText("");
}
- Kode Program untuk Button KELUAR :
private void
jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add
your handling code here:
dispose();
}
- pilih run > run file
Hasil Tampilan
akhir :





0 komentar:
Posting Komentar