0% found this document useful (0 votes)
34 views6 pages

Java

The document contains code for a food ordering application. It includes code to process user input of a name, clear fields, select different food items and display their prices, calculate a total order cost based on selected items and quantities, clear the order, and exit the application. The code handles radio button selections for different food types (noodles, chicken, goat, rice), retrieves associated prices, calculates item costs from quantities, and sums the total cost.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views6 pages

Java

The document contains code for a food ordering application. It includes code to process user input of a name, clear fields, select different food items and display their prices, calculate a total order cost based on selected items and quantities, clear the order, and exit the application. The code handles radio button selections for different food types (noodles, chicken, goat, rice), retrieves associated prices, calculates item costs from quantities, and sums the total cost.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Nama : Achmad Raditya Gunawan

Form 1
private void bprosesActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
String nama=tnama.getText();
hnama.setText(nama);
}

private void bbersihActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
hnama.setText("............");
tnama.setText("");
tnama.requestFocus();

Form 2
private void rbgorengActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:


int nasigoreng= 10000;
if (rbgoreng.isSelected())
{
txtng.setText(""+rbgoreng.getText());
txtng.setText(""+nasigoreng);
}
else
{
txtng.setText("");
}
}

private void rbmieActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
int miegoreng = 12000;
if (rbmie.isSelected())
{
txtmg.setText(""+rbmie.getText());
txtmg.setText(""+miegoreng);
}
else
{
txtmg.setText("");
}
}

private void rbayamActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
int sotoayam = 15000;
if (rbayam.isSelected())
{
txtsa.setText(""+rbayam.getText());
txtsa.setText(""+sotoayam);
}
else
{
txtsa.setText("");
}
}

private void rbkambingActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
int sopkambing = 22000;
if (rbkambing.isSelected())
{
txtsk.setText(""+rbkambing.getText());
txtsk.setText(""+sopkambing);
}
else
{
txtsk.setText("");
}
}

private void rbnasiActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
int nasi = 5000;
if (rbnasi.isSelected())
{
txtns.setText(""+rbnasi.getText());
txtns.setText(""+nasi);
}
else
{
txtns.setText("");
}
}

private void bhitungActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
int total=0;
if(rbgoreng.isSelected())
{
String ng = txtjmlng.getText();
int jmlng =Integer.parseInt(ng);
int hargang = jmlng*10000;
total= total + hargang;
}
if(rbmie.isSelected())
{
String mg = txtjmlmg.getText();
int jmlmg= Integer.parseInt(mg);
int hargamg = jmlmg*12000;
total= total + hargamg;
}
if(rbayam.isSelected())
{
String sa =txtjmlsa.getText();
int jmlsa= Integer.parseInt(sa);
int hargasa = jmlsa*15000;
total=total+hargasa;
}
if(rbkambing.isSelected())
{
String sk=txtjmlsk.getText();
int jmlsk=Integer.parseInt(sk);
int hargask = jmlsk*22000;
total=total+hargask;
}
if(rbnasi.isSelected());
{
String ns=txtjmlns.getText();
int jmlns=Integer.parseInt(ns);
int hargans = jmlns*5000;
total=total+hargans;
}
txtharga.setText(""+total);
}

private void bhapusActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
txtng.setText("");
txtjmlng.setText("");
txtmg.setText("");
txtjmlmg.setText("");
txtsa.setText("");
txtjmlsa.setText("");
txtsk.setText("");
txtjmlsk.setText("");
txtns.setText("");
txtjmlns.setText("");
}

private void bkeluarActionPerformed(java.awt.event.ActionEvent evt) {


// TODO add your handling code here:
System.exit(0);

You might also like