Sabtu, 20 November 2010
import java.io.*; import javax.swing.*; class menuLA { public static void main(String[]args) { do { String temp = JOptionPane.showInputDialog("Menu\n1. Biodata\n2. Grade Nilai\n3. Deret\n4. Matriks\n5.KELUAR"); int pil = Integer.parseInt(temp); switch(pil) { case 1: String nama = JOptionPane.showInputDialog("Masukkan nama : "); String npm = JOptionPane.showInputDialog("Masukkan npm : "); String kls = JOptionPane.showInputDialog("Masukkan kelas : "); JOptionPane.showMessageDialog(null,"nama : "+nama+"\nNPM : "+npm+"\nKelas : "+kls); break; case 2: String temp1 = JOptionPane.showInputDialog("Masukkan Nilai UTS : "); int uts = Integer.parseInt(temp1); String temp2 = JOptionPane.showInputDialog("Masukkan Nilai UAS : "); int uas = Integer.parseInt(temp2); double total = (uts*0.7)+(uas*0.3); if ((total>=80)&&(total<=90)) { JOptionPane.showMessageDialog(null,"Nilai Akhir Anda :"+total+"\nAnda Lulus dengan nilai A"); } else if ((total>=70)&&(total<=79)) { JOptionPane.showMessageDialog(null,"Nilai Akhir Anda :"+total+"\nAnda Lulus dengan nilai B"); } else if ((total>=60)&&(total<=69)) { JOptionPane.showMessageDialog(null,"Nilai Akhir Anda :"+total+"\nAnda Lulus dengan nilai C"); } else if ((total>=50)&&(total<=59)) { JOptionPane.showMessageDialog(null,"Nilai Akhir Anda :"+total+"\nAnda Lulus dengan nilai D"); } else { JOptionPane.showMessageDialog(null,"Nilai Akhir Anda :"+total+"\nAnda Lulus dengan nilai E"); } break; case 3: String temp3 = JOptionPane.showInputDialog (" Masukkan Jumlah Deret:"); int deret =Integer.parseInt(temp3); String hasil = " "; for (int i=1;i<= deret;i++) { for (int j=1;j<= i;j++) { hasil = hasil+j; } hasil = hasil+"\n"; } JOptionPane.showMessageDialog(null,hasil); break; case 4: String[][]bil = new String[3][3]; int[][] a = new int[2][2]; int[][] b = new int[2][2]; for(int i=0;i<2;i++) { for(int j=0;j<2;j++) { bil[i][j] = JOptionPane.showInputDialog("Matriks A = "+i+" "+j); a[i][j] = Integer.parseInt(bil[i][j]); } } JOptionPane.showMessageDialog(null,"Matriks A\n"+a[0][0]+" "+a[0][1]+"\n"+a[1][0]+" "+a[1][1]); case 5: JOptionPane.showMessageDialog(null,"Terima Kasih Telah Memakai Program Ini"); System.exit(0); break; default: JOptionPane.showMessageDialog(null,"Maaf Pilihan Anda Salah"); } } while(true); } }
Label: Java
1 komentar:
nice post...
Posting Komentar