Program Sederhana Kasir
Program Kasir sederhana ini menggunakan JFrame Netbeans yang dapat di fungsikan untuk menghitung jumlah tagihan/biaya dari barang yang sudah di pesan.
berikut Source Code dan Screenshotnya
SS
Sorce Code
private void ngrActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int nasigoreng = 17000;
if (ngr.isSelected()) {
txtngr.setText("" + ngr.getText());
txtngr.setText("" + nasigoreng);
} else {
txtngr.setText("");
}
}
private void mgrActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int miegoreng = 18000;
if (mgr.isSelected()) {
txtmgr.setText("" + mgr.getText());
txtmgr.setText("" + miegoreng);
} else {
txtmgr.setText("");
}
}
private void mrbsActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int mierebus = 18000;
if (mrbs.isSelected()) {
txtmrbs.setText("" + mrbs.getText());
txtmrbs.setText("" + mierebus);
} else {
txtmrbs.setText("");
}
}
private void kwtActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int kwetiau = 20000;
if (kwt.isSelected()) {
txtkwt.setText("" + kwt.getText());
txtkwt.setText("" + kwetiau);
} else {
txtkwt.setText("");
}
}
private void capActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int capcay = 25000;
if (cap.isSelected()) {
txtcap.setText("" + cap.getText());
txtcap.setText("" + capcay);
} else {
txtcap.setText("");
}
}
private void btnhitungActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int total = 0;
if (ngr.isSelected()) {
String NG = txtjmlngr.getText();
int jmlNG = Interger.parseInt(NG);
int HargaNG = jmlngr * 17000;
total = total + HargaNG;
}
if (mgr.isSelected()) {
String MG = txtjmlmgr.getText();
int jmlMG = Interger.parseInt(MG);
int HargaMG = jmlMG * 18000;
total = total + HargaMG;
}
if (mrbs.isSelected()) {
String MR = txtjmlmrbs.getText();
int jmlMR = Interger.parseInt(MR);
int HargaMR = jmlMR * 18000;
total = total + HargaMR;
}
if (kwt.isSelected()) {
String KWT = txtjmlkwt.getText();
int jmlKWT = Interger.parseInt(KWT);
int HargaKWT = jmlKWT * 20000;
total = total + HargaKWT;
}
if (cap.isSelected()) {
String CAP = txtjmlcap.getText();
int jmlCAP = Interger.parseInt(CAP);
int HargaCAP = jmlCAP * 25000;
total = total + HargaCAP;
}
txtjmlharga.setText("" + total);
}
private void btnhapusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
txtjmlngr.setEditable(false);
txtjmlngr.setText("");
txtjmlmgr.setEditable(false);
txtjmlmgr.setText("");
txtjmlmrbs.setEditable(false);
txtjmlmrbs.setText("");
txtjmlkwt.setEditable(false);
txtjmlkwt.setText("");
txtjmlcap.setEditable(false);
txtjmlcap.setText("");
}
private void btnexitActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int X = JoptionPane.showConfirmDialog(null, "Keluar Program", "Exit", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (X == JOptionPane.YES_OPTION) {
//System.exit(0);
dispose();
}
}
private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.exit(0);
}
Program Kasir sederhana ini menggunakan JFrame Netbeans yang dapat di fungsikan untuk menghitung jumlah tagihan/biaya dari barang yang sudah di pesan.
berikut Source Code dan Screenshotnya
SS
Sorce Code
private void ngrActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int nasigoreng = 17000;
if (ngr.isSelected()) {
txtngr.setText("" + ngr.getText());
txtngr.setText("" + nasigoreng);
} else {
txtngr.setText("");
}
}
private void mgrActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int miegoreng = 18000;
if (mgr.isSelected()) {
txtmgr.setText("" + mgr.getText());
txtmgr.setText("" + miegoreng);
} else {
txtmgr.setText("");
}
}
private void mrbsActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int mierebus = 18000;
if (mrbs.isSelected()) {
txtmrbs.setText("" + mrbs.getText());
txtmrbs.setText("" + mierebus);
} else {
txtmrbs.setText("");
}
}
private void kwtActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int kwetiau = 20000;
if (kwt.isSelected()) {
txtkwt.setText("" + kwt.getText());
txtkwt.setText("" + kwetiau);
} else {
txtkwt.setText("");
}
}
private void capActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int capcay = 25000;
if (cap.isSelected()) {
txtcap.setText("" + cap.getText());
txtcap.setText("" + capcay);
} else {
txtcap.setText("");
}
}
private void btnhitungActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int total = 0;
if (ngr.isSelected()) {
String NG = txtjmlngr.getText();
int jmlNG = Interger.parseInt(NG);
int HargaNG = jmlngr * 17000;
total = total + HargaNG;
}
if (mgr.isSelected()) {
String MG = txtjmlmgr.getText();
int jmlMG = Interger.parseInt(MG);
int HargaMG = jmlMG * 18000;
total = total + HargaMG;
}
if (mrbs.isSelected()) {
String MR = txtjmlmrbs.getText();
int jmlMR = Interger.parseInt(MR);
int HargaMR = jmlMR * 18000;
total = total + HargaMR;
}
if (kwt.isSelected()) {
String KWT = txtjmlkwt.getText();
int jmlKWT = Interger.parseInt(KWT);
int HargaKWT = jmlKWT * 20000;
total = total + HargaKWT;
}
if (cap.isSelected()) {
String CAP = txtjmlcap.getText();
int jmlCAP = Interger.parseInt(CAP);
int HargaCAP = jmlCAP * 25000;
total = total + HargaCAP;
}
txtjmlharga.setText("" + total);
}
private void btnhapusActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
txtjmlngr.setEditable(false);
txtjmlngr.setText("");
txtjmlmgr.setEditable(false);
txtjmlmgr.setText("");
txtjmlmrbs.setEditable(false);
txtjmlmrbs.setText("");
txtjmlkwt.setEditable(false);
txtjmlkwt.setText("");
txtjmlcap.setEditable(false);
txtjmlcap.setText("");
}
private void btnexitActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int X = JoptionPane.showConfirmDialog(null, "Keluar Program", "Exit", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
if (X == JOptionPane.YES_OPTION) {
//System.exit(0);
dispose();
}
}
private void jMenu1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
System.exit(0);
}
Komentar
Posting Komentar