Ketika masuk kuliah pertama saya mendapatkan tugas untuk membuat progam menghitung IPK. Dan inilah hasil dari coding saya dengan menggunakan netbeans..
Algoritma IPK
public class AlgoritmaIpk1 {
//deklarasi
static int kalkulus;
static int fisika;
static int apti;
static int sks1;
static int sks2;
static int sks3;
static int jumlahsks;
static double ipk;
static int bobot1;
static int bobot2;
static int bobot3;
static int makul1;
static int makul2;
static int makul3;
//deskripsi
public static void main(String [] args){
kalkulus =75;
fisika = 70;
apti = 90;
sks1 = 3;
sks2 = 2;
sks3 = 3;
if (kalkulus >=85 && kalkulus <=100){
bobot1 = 4;
} else if (kalkulus >=75 && kalkulus <=84){
bobot1 = 3;
} else {
bobot1 = 2;
}if (fisika >=85 && fisika <=100){
bobot2 = 4;
} else if (fisika >=75 && fisika <=84){
bobot2 =3;
} else {
bobot2 = 2;
}if (apti >=85 && apti <=100){
bobot3 = 4;
} else if (apti >=75 && apti <=84){
bobot3 = 3;
} else {
bobot3 = 2;
}
makul1 = bobot1*sks1 ;
makul2 = bobot2*sks2 ;
makul3 = bobot3*sks3;
ipk = kalkulus+fisika+apti;
jumlahsks = sks1+sks2+sks3;
ipk = ipk/jumlahsks;
JOptionPane.showMessageDialog(null, "ipk " +ipk);
}
}
No comments:
Post a Comment