import javax.swing.JOptionPane;
public class STMIK
{
public static void main (String[]args)
{
String pil = "";
String out ="";
String itgs = "";
String imid = "";
String ifin = "";
String iquiz = "";
int menu = 0;
int tgs = 0;
int mid = 0;
int fin = 0;
int quiz =0;
double rata=0;
pil = JOptionPane.showInputDialog ("Masukkan Pilihan Anda : "+
"\n1. Biodata."+"\n2. Index Prestasi.");
menu = Integer.parseInt (pil);
switch (menu)
{
case 1:
itgs = JOptionPane.showInputDialog ("Input Nama Mahasiswa : ");
imid = JOptionPane.showInputDialog ("Input Jurusan : ");
ifin = JOptionPane.showInputDialog ("Input Angkatan : ");
out = "BIODATA MAHASISWA"+"\nNama : "+(itgs)
+"\nJurusan : "+(imid)
+"\nAngkatan : "+(ifin);
break ;
case 2:
itgs = JOptionPane.showInputDialog ("Input Nilai Tugas :");
imid = JOptionPane.showInputDialog ("Input Nilai Mid :");
ifin = JOptionPane.showInputDialog ("Input Nilai Final :");
iquiz= JOptionPane.showInputDialog ("Input Nilai Quiz :");
tgs = Integer.parseInt (itgs);
mid = Integer.parseInt (imid);
fin = Integer.parseInt (ifin);
quiz= Integer.parseInt (iquiz);
rata = (tgs+mid+fin+quiz)/4;
out += "Nilai Rata-Rata = "+Double.toString (rata);
if (rata >= 75)
out += "\nSelamat Anda LuLus !!!";
else
out += "\nMaaf,, Anda Gagal !!!";
break ;
default:
out = "Pilihan Anda Salah . . . .";
}
JOptionPane.showMessageDialog (null, out);
System.exit(0);
}
}
Sabtu, 29 Mei 2010
Contoh Program Java Swing Menggunakan Case
Langganan:
Posting Komentar (Atom)
Comments :
0 komentar to “Contoh Program Java Swing Menggunakan Case”
Posting Komentar