Posted by : Unknown Sunday, September 18, 2011

Persoalan yang akan dibuat program :
Paket Tour PT. Blog Saya
Paket Tour
Biaya
Tambahan
Singapore
US$1000
US$250
Thailand
US$1300
US$500
Hongkong
US$1500
US$750
Jika lama perjalanan 7 hari atau kurang maka tidak dikenakan tambahan biaya, jika lama perjalanan lebih dari 7 hari maka akan dikenakan tambahan biaya sesuai paket tour per hari.

Program :
import javax.swing.*;
public class tour
{
public static void main (String[]args){
int biaya;
int tambahan;
int bayar;
String pakets;
String input1 = JOptionPane.showInputDialog ("Masukan Nama :");
String nama = input1;
String input2 = JOptionPane.showInputDialog ("Pilihan Paket :\n"+"1.Singapore\n"+"2.Thailand\n"+"3.Hongkong\n"+"Masukan Paket Tour :");
int paket = Integer.parseInt (input2);
String input3 = JOptionPane.showInputDialog ("Masukan Lama Tour :");
int lama = Integer.parseInt (input3);
switch (paket)
{
case 1 :
pakets = "Singapore";
biaya = 1000;
if (lama>7){
tambahan = (lama-7)*250;
}
else{
tambahan = 0;
}
bayar = biaya+tambahan;
JOptionPane.showMessageDialog(null,"Nama :"+nama+"\n"+"Paket Tour :"+pakets+"\n"+"Lama Tour :"+lama+"\n"+"Biaya :"+biaya+"\n"+"Tambahan :"+tambahan+"\n"+"Bayar :"+bayar);
break;
case 2 :
pakets = "Thailand";
biaya = 1300;
if (lama>7){
tambahan = (lama-7)*500;
}
else{
tambahan = 0;
}
bayar = biaya+tambahan;
JOptionPane.showMessageDialog(null,"Nama :"+nama+"\n"+"Paket Tour :"+pakets+"\n"+"Lama Tour :"+lama+"\n"+"Biaya :"+biaya+"\n"+"Tambahan :"+tambahan+"\n"+"Bayar :"+bayar);
break;
case 3 :
pakets = "Hongkong";
biaya = 1500;
if (lama>7)
{
tambahan = (lama-7)*750;
}
else{
tambahan = 0;
}
bayar = biaya+tambahan;
JOptionPane.showMessageDialog(null,"Nama :"+nama+"\n"+"Paket Tour :"+pakets+"\n"+"Lama Tour :"+lama+"\n"+"Biaya :"+biaya+"\n"+"Tambahan :"+tambahan+"\n"+"Bayar :"+bayar);
break;
default :
JOptionPane.showMessageDialog(null,"Tidak ada pilihan paket");
}
}

Leave a Reply

Silahkan berikan komentar disini...

Subscribe to Posts | Subscribe to Comments

Computing Cup 2011 Banner

Computing Cup Banner

Clock

Calendar

Popular Post

Blog Archive

Powered by Blogger.

- Copyright © Sharing & Tutorial -Metrominimalist- Powered by Blogger - Designed by KoplakerZ™ -