import java.io.*;
import javax.swing.*;
class fransiscus_xaverius_gammasto
{
public static void main (String[]args)
{
do
{
String temp = JOptionPane.showInputDialog (null,"=======MENU======== \n1. Biodata\n2. UTS/UAS\n3. Deret\n4. Keluar");
int pil = Integer.parseInt (temp);
switch (pil) {
case 1 : String nama = JOptionPane.showInputDialog ("Masukkan Nama : ");
int npm = Integer.parseInt (JOptionPane.showInputDialog ("Masukkan NPM : "));
String kelas = JOptionPane.showInputDialog ("Masukkan Kelas : ");
JOptionPane.showMessageDialog (null, "Nama : "+nama+ "\nNpm : "+npm+ "\nKelas : "+kelas);
break;
case 2 : double uts = Double.parseDouble (JOptionPane.showInputDialog (null,"Masukkan nilai UTS : "));
double uas = Double.parseDouble (JOptionPane.showInputDialog (null,"Masukkan nilai UAS : "));
double hasil = ((uas*0.3)+(uts*0.7));
{
if (hasil >= 80 && hasil <= 100)
JOptionPane.showMessageDialog (null,"Nilai anda : "+hasil+"\nAnda Mendapat nilai A");
else if (hasil >= 70 && hasil < 80)
JOptionPane.showMessageDialog (null,"Nilai anda : "+hasil+"\nAnda Mendapat nilai B");
else if (hasil >= 60 && hasil < 70)
JOptionPane.showMessageDialog (null,"Nilai anda : "+hasil+"\nAnda Mendapat nilai C");
else if (hasil >= 50 && hasil < 60)
JOptionPane.showMessageDialog (null,"Nilai anda : "+hasil+"\nAnda Mendapat nilai D");
else if (hasil >= 0 && hasil < 50 )
JOptionPane.showMessageDialog (null,"Nilai anda : "+hasil+"\nAnda Mendapat nilai E");
}
break;
case 3 : int deret = Integer.parseInt (JOptionPane.showInputDialog ("Masukkan Banyaknya Perulangan : "));
String simpan = "";
for (int i = 1 ;i<= deret ;i++ )
{
for (int j = 1;j<= i ;j++ )
{
simpan = simpan+j;
}
simpan = simpan+"\n";
}
JOptionPane.showMessageDialog(null,simpan);
break;
case 4 : JOptionPane.showMessageDialog (null,"Terima kasih");
System.exit(0);
break;
default : JOptionPane.showMessageDialog (null,"Maaf input yang anda masukkan salah !!");
}
}
while(true); }
}
import javax.swing.*;
class fransiscus_xaverius_gammasto
{
public static void main (String[]args)
{
do
{
String temp = JOptionPane.showInputDialog (null,"=======MENU======== \n1. Biodata\n2. UTS/UAS\n3. Deret\n4. Keluar");
int pil = Integer.parseInt (temp);
switch (pil) {
case 1 : String nama = JOptionPane.showInputDialog ("Masukkan Nama : ");
int npm = Integer.parseInt (JOptionPane.showInputDialog ("Masukkan NPM : "));
String kelas = JOptionPane.showInputDialog ("Masukkan Kelas : ");
JOptionPane.showMessageDialog (null, "Nama : "+nama+ "\nNpm : "+npm+ "\nKelas : "+kelas);
break;
case 2 : double uts = Double.parseDouble (JOptionPane.showInputDialog (null,"Masukkan nilai UTS : "));
double uas = Double.parseDouble (JOptionPane.showInputDialog (null,"Masukkan nilai UAS : "));
double hasil = ((uas*0.3)+(uts*0.7));
{
if (hasil >= 80 && hasil <= 100)
JOptionPane.showMessageDialog (null,"Nilai anda : "+hasil+"\nAnda Mendapat nilai A");
else if (hasil >= 70 && hasil < 80)
JOptionPane.showMessageDialog (null,"Nilai anda : "+hasil+"\nAnda Mendapat nilai B");
else if (hasil >= 60 && hasil < 70)
JOptionPane.showMessageDialog (null,"Nilai anda : "+hasil+"\nAnda Mendapat nilai C");
else if (hasil >= 50 && hasil < 60)
JOptionPane.showMessageDialog (null,"Nilai anda : "+hasil+"\nAnda Mendapat nilai D");
else if (hasil >= 0 && hasil < 50 )
JOptionPane.showMessageDialog (null,"Nilai anda : "+hasil+"\nAnda Mendapat nilai E");
}
break;
case 3 : int deret = Integer.parseInt (JOptionPane.showInputDialog ("Masukkan Banyaknya Perulangan : "));
String simpan = "";
for (int i = 1 ;i<= deret ;i++ )
{
for (int j = 1;j<= i ;j++ )
{
simpan = simpan+j;
}
simpan = simpan+"\n";
}
JOptionPane.showMessageDialog(null,simpan);
break;
case 4 : JOptionPane.showMessageDialog (null,"Terima kasih");
System.exit(0);
break;
default : JOptionPane.showMessageDialog (null,"Maaf input yang anda masukkan salah !!");
}
}
while(true); }
}
No comments:
Post a Comment