Membuat Program dijava Netbeans
Disini saya akan Membuat Program java Netbeans yaitu mesin Es Cream otomatis yang digunakan untuk menghitung Jumlah Es yang akan dibeli
Requirement: Java
Netbeans
Komputer
yang Pertama yaitu
1.) Pilih
Pilih > File > New Project > Next > "Nama Project" > Finish
Gambar dibawah adalah Project yang sudah jadi
2.) Design.
Untuk Design Saya seperti ini
3.) Source.
Untuk Coding
Ini Formmat Textnya
private void normalBtnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (normalBtn.isSelected());
blackBtn.setSelected(false);
goldBtn.setSelected(false);
reddishBtn.setSelected(false);
mixBtn.setSelected(false);
private void blackBtnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (blackBtn.isSelected());
normalBtn.setSelected(false);
goldBtn.setSelected(false);
reddishBtn.setSelected(false);
mixBtn.setSelected(false);
}
private void goldBtnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (goldBtn.isSelected());
blackBtn.setSelected(false);
normalBtn.setSelected(false);
reddishBtn.setSelected(false);
mixBtn.setSelected(false);
}
private void reddishBtnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (reddishBtn.isSelected());
blackBtn.setSelected(false);
goldBtn.setSelected(false);
normalBtn.setSelected(false);
mixBtn.setSelected(false);
}
private void mixBtnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (mixBtn.isSelected());
blackBtn.setSelected(false);
goldBtn.setSelected(false);
reddishBtn.setSelected(false);
normalBtn.setSelected(false);
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
double total;
double subtotal = 0;
final double TAXRATE = 0;
double tax;
if (normalBtn.isSelected()){
subtotal = subtotal + 3.00;
}else if (blackBtn.isSelected()){
subtotal = subtotal + 7.00;
}else if (goldBtn.isSelected()){
subtotal = subtotal + 8.00;
}else if (mixBtn.isSelected()){
subtotal =subtotal + 9.00;
}else if (reddishBtn.isSelected()){
subtotal = subtotal + 9.00;
}
subtotalTF.setText(Double.toString(subtotal));
subtotal = Double.parseDouble(subtotalTF.getText());
tax = subtotal * TAXRATE;
total = tax + subtotal;
taxTF.setText(Double.toString(tax));
totalTF.setText(Double.toString(total));
Hasil Run
Gambar dibawah adalah Project yang sudah jadi
2.) Design.
Untuk Design Saya seperti ini
3.) Source.
Untuk Coding
Ini Formmat Textnya
private void normalBtnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (normalBtn.isSelected());
blackBtn.setSelected(false);
goldBtn.setSelected(false);
reddishBtn.setSelected(false);
mixBtn.setSelected(false);
private void blackBtnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (blackBtn.isSelected());
normalBtn.setSelected(false);
goldBtn.setSelected(false);
reddishBtn.setSelected(false);
mixBtn.setSelected(false);
}
private void goldBtnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (goldBtn.isSelected());
blackBtn.setSelected(false);
normalBtn.setSelected(false);
reddishBtn.setSelected(false);
mixBtn.setSelected(false);
}
private void reddishBtnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (reddishBtn.isSelected());
blackBtn.setSelected(false);
goldBtn.setSelected(false);
normalBtn.setSelected(false);
mixBtn.setSelected(false);
}
private void mixBtnActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (mixBtn.isSelected());
blackBtn.setSelected(false);
goldBtn.setSelected(false);
reddishBtn.setSelected(false);
normalBtn.setSelected(false);
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
double total;
double subtotal = 0;
final double TAXRATE = 0;
double tax;
if (normalBtn.isSelected()){
subtotal = subtotal + 3.00;
}else if (blackBtn.isSelected()){
subtotal = subtotal + 7.00;
}else if (goldBtn.isSelected()){
subtotal = subtotal + 8.00;
}else if (mixBtn.isSelected()){
subtotal =subtotal + 9.00;
}else if (reddishBtn.isSelected()){
subtotal = subtotal + 9.00;
}
subtotalTF.setText(Double.toString(subtotal));
subtotal = Double.parseDouble(subtotalTF.getText());
tax = subtotal * TAXRATE;
total = tax + subtotal;
taxTF.setText(Double.toString(tax));
totalTF.setText(Double.toString(total));
Hasil Run
Sekian dan Terimakasih