Aplikasi Penghitung Nilai Kelulusan Mahasiswa
Penjelasan
Program Penghitung Nilai Kelulusan Mahasiswa
Aplikasi yang saya buat adalah sebuah perogram penghitung nilai kelulusan Mahasiswa, Menentukan lulus atau tidak lulusnya Mahasiswa, Perogram ini berguna sekali karena cukup dengan satu sistem bisa mengetahui hasil nilai kelulusan Mahasiswa.
Flow chart
Screen shoot frame
Sourch code
import javax.swing.JOptionPane;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author programmer
*/
public class NilaiKelulusanMahasiswa extends javax.swing.JDialog {
/**
* Creates new form NilaiKelulusanMahasiswa
*/
public NilaiKelulusanMahasiswa(java.awt.Frame parent, boolean modal) {
super(parent, modal);
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
tfNim = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
tfNama = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
tfMatKul = new javax.swing.JTextField();
tfNilaiTugas = new javax.swing.JTextField();
tfNilaiUTS = new javax.swing.JTextField();
tfNilaiUAS = new javax.swing.JTextField();
jLabel8 = new javax.swing.JLabel();
tvStatus = new javax.swing.JLabel();
jLabel9 = new javax.swing.JLabel();
tvGrade = new javax.swing.JLabel();
btnHitung = new javax.swing.JButton();
btnUlangi = new javax.swing.JButton();
jLabel10 = new javax.swing.JLabel();
tfAbsen = new javax.swing.JTextField();
tvStatusAkhir = new javax.swing.JLabel();
tvGradeAkhir = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Lucida Grande", 0, 20)); // NOI18N
jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel1.setText("PROGRAM NILAI KELULUSAN MAHASISWA");
jLabel2.setText("NIM");
tfNim.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
tfNimActionPerformed(evt);
}
});
jLabel3.setText("Nama");
tfNama.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
tfNamaActionPerformed(evt);
}
});
jLabel4.setText("Mata Kuliah");
jLabel5.setText("Nilai Tugas");
jLabel6.setText("Nilai UTS");
jLabel7.setText("Nilai UAS");
tfMatKul.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
tfMatKulActionPerformed(evt);
}
});
jLabel8.setText("Status");
jLabel9.setText("Grade");
btnHitung.setText("Hitung");
btnHitung.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnHitungActionPerformed(evt);
}
});
btnUlangi.setText("Ulangi");
btnUlangi.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnUlangiActionPerformed(evt);
}
});
jLabel10.setText("Nilai Absen");
tfAbsen.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
tfAbsenActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(16, 16, 16)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel9)
.addComponent(jLabel8)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel10)
.addComponent(jLabel1)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(tfNilaiUTS, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(tfNilaiTugas, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3)
.addComponent(jLabel4))
.addGap(89, 89, 89)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tfNilaiUAS, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(btnHitung)
.addGap(18, 18, 18)
.addComponent(btnUlangi))
.addComponent(tvGrade)
.addComponent(tvStatus)
.addComponent(tfNim)
.addComponent(tfNama)
.addComponent(tfMatKul)
.addComponent(tfAbsen, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE))
.addComponent(tvStatusAkhir)
.addComponent(tvGradeAkhir)))))
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel7)
.addGap(344, 344, 344))))
.addContainerGap(28, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(34, 34, 34)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(tfNim, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(tfNama, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4)
.addComponent(tfMatKul, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel10)
.addComponent(tfAbsen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5)
.addComponent(tfNilaiTugas, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel6)
.addComponent(tfNilaiUTS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(tfNilaiUAS, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(9, 9, 9)
.addComponent(tvStatus)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(tvStatusAkhir))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addComponent(tvGradeAkhir))
.addGap(30, 30, 30)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnHitung)
.addComponent(btnUlangi))
.addGap(147, 147, 147)
.addComponent(tvGrade)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
private void tfNimActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void tfNamaActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void tfMatKulActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
private void btnHitungActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
final String nim = tfNim.getText().trim().toString();
final String nama = tfNama.getText().trim().toString();
final String mataKuliah = tfMatKul.getText().trim().toString();
final String absen = tfAbsen.getText().trim().toString();
final String tugas = tfNilaiTugas.getText().trim().toString();
final String uts = tfNilaiUTS.getText().trim().toString();
final String uas = tfNilaiUAS.getText().trim().toString();
if (nim.isEmpty() || nama.isEmpty() || mataKuliah.isEmpty() || tugas.isEmpty() || uts.isEmpty() || uas.isEmpty()) {
JOptionPane.showMessageDialog(null, "Semua kolom wajib diisi");
return;
}
final double skorAbsen = Double.parseDouble(absen) / 100 * 10;
final double skorTugas = Double.parseDouble(tugas) / 100 * 20;
final double skorUts = Double.parseDouble(uts) / 100 * 30;
final double skorUas = Double.parseDouble(uas) / 100 * 40;
final double skorAkhir = skorAbsen + skorTugas + skorUts + skorUas;
final String grade;
final String status;
if (skorAkhir >= 85) {
grade = "A";
status = "Lulus";
} else if (skorAkhir >= 70) {
grade = "B";
status = "Lulus";
} else if (skorAkhir >= 60) {
grade = "C";
status = "Lulus";
} else if (skorAkhir >= 50) {
grade = "D";
status = "Lulus";
} else {
grade = "E";
status = "Tidak Lulus";
}
tvGradeAkhir.setText(grade);
tvStatusAkhir.setText(status);
}
private void btnUlangiActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
tfNim.setText("");
tfNama.setText("");
tfMatKul.setText("");
tfAbsen.setText("");
tfNilaiTugas.setText("");
tfNilaiUTS.setText("");
tfNilaiUAS.setText("");
tvStatusAkhir.setText("");
tvGradeAkhir.setText("");
}
private void tfAbsenActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(NilaiKelulusanMahasiswa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(NilaiKelulusanMahasiswa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(NilaiKelulusanMahasiswa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(NilaiKelulusanMahasiswa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the dialog */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
NilaiKelulusanMahasiswa dialog = new NilaiKelulusanMahasiswa(new javax.swing.JFrame(), true);
dialog.addWindowListener(new java.awt.event.WindowAdapter() {
@Override
public void windowClosing(java.awt.event.WindowEvent e) {
System.exit(0);
}
});
dialog.setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JButton btnHitung;
private javax.swing.JButton btnUlangi;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9;
private javax.swing.JTextField tfAbsen;
private javax.swing.JTextField tfMatKul;
private javax.swing.JTextField tfNama;
private javax.swing.JTextField tfNilaiTugas;
private javax.swing.JTextField tfNilaiUAS;
private javax.swing.JTextField tfNilaiUTS;
private javax.swing.JTextField tfNim;
private javax.swing.JLabel tvGrade;
private javax.swing.JLabel tvGradeAkhir;
private javax.swing.JLabel tvStatus;
private javax.swing.JLabel tvStatusAkhir;
// End of variables declaration
}
Komentar
Posting Komentar