0% found this document useful (0 votes)
10 views

Program Loundry0.1

The document describes a laundry program with the following key details: 1. It allows users to input customer name, item weight, delivery date, and select regular or express service. 2. It calculates the price based on weight and service type, plus the delivery date. 3. It outputs a receipt with the customer and laundry details, including item weight, service type, dates, price and total cost.

Uploaded by

Bagus Kurniawan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Program Loundry0.1

The document describes a laundry program with the following key details: 1. It allows users to input customer name, item weight, delivery date, and select regular or express service. 2. It calculates the price based on weight and service type, plus the delivery date. 3. It outputs a receipt with the customer and laundry details, including item weight, service type, dates, price and total cost.

Uploaded by

Bagus Kurniawan
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

 Program Loundry0.1.

package akhir;

import javax.swing.JOptionPane;

public class loundry extends javax.swing.JFrame {

int tgl_msk,tgl_klr,tgl;

double berat,hrg,total;

String nama,prfm,jenis;

public loundry() {

initComponents();

public void reset(){

nama="";

berat=0.0;

jenis="";

tgl_msk=0;

tgl_klr=0;

prfm = "";

txt_nama.setText(nama);

txt_berat.setText("");

Group1.clearSelection();

txt_masuktgl.setText("");

cmb_prfm.setSelectedItem("Pilih");

txt_tmpl.setText("");

public void getData(){

nama=txt_nama.getText();

berat=Double.parseDouble(txt_berat.getText());

if(rd_reg.isSelected()){

jenis="Regular";

hrg=3500;

tgl=3;

}else{
jenis="Express";

hrg=7000;

tgl=1;

tgl_msk=Integer.parseInt(txt_masuktgl.getText());

tgl_klr=tgl_msk+tgl;

if(tgl_klr>31){

tgl_klr=tgl_klr-31;

switch(cmb_prfm.getSelectedIndex()){

case 1:

prfm="Lily";

break;

case 2:

prfm="Aqua";

break;

case 3:

prfm="Fresh";

break;

default:

JOptionPane.showMessageDialog(this, "Pilih Parfum dulu Cu");

break;

total=berat*hrg;

public void hitung(){

txt_tmpl.setText("Nama :"+nama

+"\nBerat : "+berat+" Kg"

+"\nJenis : "+jenis

+"\nMasuk : "+tgl_msk

+"\nSelesai : "+tgl_klr
+"\nParfum : "+prfm

+"\nTotal : "+total);

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

switch(cmb_prfm.getSelectedIndex()){

case 1:

prfm="Lily";

break;

case 2:

prfm="Aqua";

break;

case 3:

prfm="Fresh";

break;

default:

JOptionPane.showMessageDialog(this, "Pilih Parfum dulu Cu");

break;

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

getData();

hitung();

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

reset();

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

getData();

if(tgl_msk>31){

tgl_msk=0;

txt_masuktgl.setText("");

JOptionPane.showMessageDialog(null,"Masukin Ulang");

tgl_msk=Integer.parseInt(txt_masuktgl.getText());
}

 Program LoundryAsp.
package laundryjava;

import javax.swing.*;

import javax.swing.JOptionPane;

public class laundry extends javax.swing.JFrame {

public String namaPelanggan,parfum,jenisLaundry;

public int berat,tglMsk,tglSlsai,total,harga,waktu;

public laundry() {

initComponents();

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

jenisLaundry = "Express";

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

try { //Mendeteksi kesalahan dengan exception handling

parfum = jCbbParfum.getSelectedItem().toString();

berat = Integer.parseInt(jBerattxt.getText());

tglMsk = Integer.parseInt(jTglMsktxt.getText());

if(jRb1.isSelected()){

harga = 7000;

waktu = 1;

total = berat*harga;

}else if(jRb2.isSelected()){

harga = 3500;

waktu = 3;

total = berat*harga;

tglSlsai=tglMsk+waktu;
if(tglSlsai>31){

tglSlsai=tglSlsai-31;

jNotatxt.setText("==================NOTA=================="

+"\nNama\t: "+jNamatxt.getText()

+"\nBerat\t: "+jBerattxt.getText()+" kg"

+"\nJenis Loundry\t: "+jenisLaundry

+"\nTanggal Masuk\t: "+jTglMsktxt.getText()

+"\nTanggal Selesai: "+tglSlsai

+"\nParfum\t: "+parfum

+"\nTotal Bayar\t: "+total);

} catch (NumberFormatException e) {

JOptionPane.showMessageDialog(this, "Pastikan Berat dan tanggal menggunakan


angka!");

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

jenisLaundry = "Reguler";

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

jNotatxt.setText("");

jNamatxt.setText("");

jBerattxt.setText("");

jTglMsktxt.setText("");

You might also like