Selasa, 26 Maret 2013

PROGRAM PENGHITUNGAN IPK


Pada Kesempatan Kali ini saya akan membuat program PENGHITUNG NILAI IPK,berikut coding programnya :



package ujian401;
import java.io.*;
public class khs {
    int totalnilai;
    int uts[] = new int[10];
    int uas[] = new int[10];
    String makul[] = new String[10];
    String huruf[] = new String[10];
    int total[] = new int[10];
    String kdmk[] = new String[10];
    int sks[] = new int[10];

    float ip;
    int x,y=1,z=1,jmlsks=0;
    float jmlsksdiambil;
    float nilai=0;
    void inputan() throws IOException {
        BufferedReader input  = new BufferedReader(new InputStreamReader(System.in));
        for(x=1;x<=7;x++){
            if(x==1){
                sks[x]=4;
                makul[x]="SISTEM BERKAS";
                kdmk[x]="44202";
                System.out.println("SISTEM BERKAS");
            }
            else if(x==2){
                sks[x]=2;
                kdmk[x]="44203";
                makul[x]="Matematika informatika 4";
                System.out.println("Matematika informatika 4");
            }
            else if(x==3){
                sks[x]=2;
                kdmk[x]="44204";
                makul[x] = "Pemrograman Berbasis Objek";
                System.out.println("Pemrograman Berbasis Objek");
            }
            else if(x==4){
                sks[x]=2;
                kdmk[x]="44207";
                makul[x] = "BAHASA INGGRIS ";
                System.out.println("BAHASA INGGRIS");
            }
            else if(x==5){
                sks[x]=4;
                kdmk[x]="44209";
                makul[x] = "Matematika Lanjut";
                System.out.println("Matematika Lanjut");
            }
            else if(x==6){
                sks[x]=4;
                kdmk[x]="44211";
                makul[x]= "Sistem Informasi Manajemen";
                System.out.println("Sistem Informasi Manajemen");
            }
            else if(x==7){
                sks[x]=2;
                kdmk[x]="44212";
                makul[x]="PRAKTIKUM ALGORITMA DAN PEMROGRAMAN";
                System.out.println("PRAKTIKUM ALGORITMA DAN PEMROGRAMAN");
            }

            System.out.print("Nilai UTS     : ");
            uts[x]= Integer.parseInt(input.readLine());
            System.out.print("Nilai UAS     : ");
            uas[x]=Integer.parseInt(input.readLine());
            jmlsks=jmlsks+sks[x];
            totalnilai=totalnilai+(uas[x]+uts[x])/2;
        }
    }

    void nilaihuruf(){
        while(y!=x){
            total[y]=(uts[y]+uas[y])/2;
            if(total[y]>=85){
                nilai=nilai+(4*sks[y]);
                huruf[y]="A";
                jmlsksdiambil=jmlsksdiambil+4;
            }
            else if(total[y]>=70){
                nilai=nilai+(3*sks[y]);
                huruf[y]="B";
                jmlsksdiambil=jmlsksdiambil+3;
            }
            else if(total[y]>=60){
                nilai=nilai+(1*sks[y]);
                huruf[y]="C";
                jmlsksdiambil=jmlsksdiambil+2;
            }
            else{
                nilai=nilai+0;
                huruf[y]="D";
                jmlsksdiambil=jmlsksdiambil+2;
            }
            y++;
        }
        ip = nilai/jmlsks;
    }
    void tampilan(){
        System.out.println("NO || Kode MK  ||       Mata Kuliah         ||  SKS  ||  Nilai Huruf");
        System.out.println("===========================================================================");
        for(z=1;z<y;z++){
            System.out.println(z+"       "+kdmk[z]+"       "+makul[z]+"                    "+sks[z]+"             "+huruf[z]);
        }
        System.out.println("JUMLAH SKS = "+jmlsks);
        System.out.println("IP SEMESETER = "+ip);
        System.out.println("JUMLAH SKS DIAMBIL = "+jmlsksdiambil);
    }
}

dan berikut adalah salah satu outputnya :


Gambar1. Menginput Nilai setiap matkul

Gambar2. Penghitungan Nilai di IPK

0 komentar:

Posting Komentar