This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Pentingnya Menjaga Privasi Online

Menjaga Privasi online sangatlah penting dimana informasi data pribadi kita sangat berharga, bahkan lebih berharga daripada yang kita bayangkan.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Minggu, 06 November 2011

Hadiah Random ( Switch Case)

Ada Apa Hari Ini..
Kali ini saya mencoba membuat program undian berhadiah dengan case.


package undian;

import javax.swing.JOptionPane;

/**
 *
 * @author user
 */
public class hadiahRandom {
    public static void main(String[] args) {
    int hadiah = JOptionPane.showConfirmDialog(null,"apakah "+
      "anda ingin hadiah","Undian",JOptionPane.YES_NO_OPTION);
            if (hadiah==JOptionPane.YES_OPTION){
            switch(hadiah){
                case JOptionPane.YES_OPTION :
                    JOptionPane.showMessageDialog(null,"1 Unit Pesawat",
                    "Hadiah Yang Anda Dapat :",JOptionPane.INFORMATION_MESSAGE);
                                        
                }   
       int hadiah2=  JOptionPane.showConfirmDialog(null,"Apakah Anda Ingin"+
               "Hadiah Lagi","hadiah",JOptionPane.YES_NO_OPTION);
            if (hadiah2==JOptionPane.YES_OPTION){
             switch(hadiah2){
                  case JOptionPane.YES_OPTION :
                     JOptionPane.showMessageDialog(null,"100 Unit mobil",
                     "Hadiah Yang Anda Dapat :",JOptionPane.INFORMATION_MESSAGE);
             break;
             }
           }
        }
    }