import java.io.*;
import javax.swing.*;
class JulioMenu
{
public static void main(String[]args)
{
do
{
String temp = JOptionPane.showInputDialog ("<<<<>>>>\n1. Biodata \n2. Perhitungan Nilai \n3. Deret \n4. Matriks \n5. Keluar");
int pilihan = Integer.parseInt(temp);
switch (pilihan)
{
case 1:
String nama = JOptionPane.showInputDialog("Masukkan Nama Anda :");
String npm = JOptionPane.showInputDialog("Masukkan NPM Anda :");
JOptionPane.showMessageDialog(null,"Nama Andaa dalah "+nama+"\nDengan NPM "+npm);
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];
int[][] c = 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]);
}
}
for(int i=0;i<2;i++)>
{
for(int j=0;j<2;j++)>
{
bil[i][j] =JOptionPane.showInputDialog("Matriks B = "+i+" "+j);
b[i][j] = Integer.parseInt(bil[i][j]);
}
}
JOptionPane.showMessageDialog(null,"MATRIKSA\n"+a[0][0]+""+a[0][1]+"\n"+a[1][0]+" " +a[1][1]);
JOptionPane.showMessageDialog(null,"MATRIKSB\n"+b[0][0]+""+b[0][1]+"\n"+b[1][0]+" " +b[1][1]);
break;
case 5 :
JOptionPane.showMessageDialog(null,"Terimakasih");
System.exit(0);
break;
default :
JOptionPane.showMessageDialog(null,"Pilihan Hanya 1 s/d 4!!!");
}
}
while(true);
}
}
Tidak ada komentar:
Posting Komentar