Contoh Program Menghitung IP Mahasiswa Pada JAVA /*file name : Menghitung IPK mahasiswa programer : Andes Arinal G deskripsi : 1.menggunakan If else bersarang 2. Dengan menginput bilangannya */ import javax.swing.*; public class MenghitungIpkMahasiswa { public static void main (String [] args) { String namaS = JOptionPane.showInputDialog(" NAMA ANDA : " ); String tugasS = JOptionPane.showInputDialog(" Nilai tugas : "); int tugas = Integer.parseInt(tugasS); String utsS = JOptionPane.showInputDialog(" Nilai UTS : "); int uts = Integer.parseInt(utsS); String uasS = JOptionPane.showInputDialog(" Nilai UAS : " ); int uas = Integer.parseInt(uasS); //String hasilS; int hasil; char grade; //tugas=1; //uts=1; //uas=1; hasil=( ( 20*tugas+30*uts+50*uas)/100); if ( hasil >= 0 && hasil <= 39) { grade = 'E'; } else if ( hasil >= 40 && hasil <= 55) { grade = 'D'; } else if( hasil >= 56 && hasil <= 79) { grade = 'C'; } else if( hasil >= 80 && hasil <= 89) { grade = 'B'; } else if( hasil >= 90 && hasil <= 100) { grade = 'A'; } else { System.out.print("!mposible..."); grade = '?'; } JOptionPane.showMessageDialog (null, " Nama Anda : " +namaS+" \nNilai Tugas : " +tugasS+" \n Nilai UTS : "+utsS+" \n Nilai UAS : " +uasS+ "\n Nilai Angka = " +hasil+ "\n Nilai Indeks = "+grade); } } Hasill :