Selasa, 07 Juni 2011

koding java

import java.util.Scanner;
public class Baru {
    public static void main(String[] args){
        Scanner input=new Scanner(System.in);
        garis();
        System.out.println("            MENU PILIHAN                  ");
        garis();
        System.out.println("1. Menhitung Nilai Mahasiswa");
        System.out.println("");
        System.out.println("2. Exit");
        garis();
        System.out.println("");
        System.out.print("Anda pilih no   :");
        int pilih=input.nextInt();

        switch(pilih){
            case 1:{
               
                int[] npm=new int[20];
                String[] nama=new String[20];
                String[] jur=new String[20];
                String[] mk=new String[20];
                int[] n_tgas=new int[20];
                int[] n_uts=new int[20];
                int[] n_uas=new int[20];


                garis();
                System.out.println("    MENGHITUNG NILAI MAHASISWA");
                garis();
                System.out.println("");
                System.out.print("Masukan jumlah data ="); int n=input.nextInt();

                for(int i=1;i<=n;i++){
                    System.out.println("Data ke"+i +":");
                    System.out.print("NPM           :"); npm[i]=input.nextInt();
                    System.out.print("Nama          :"); nama[i]=input.next();
                    System.out.print("Jurusan       :"); jur[i]=input.next();
                    System.out.print("Mata Kuliah   :"); mk[i]=input.next();
                    System.out.print("Nilai tugas   :"); n_tgas[i]=input.nextInt();
                    System.out.print("Nilai UTS     :"); n_uts[i]=input.nextInt();
                    System.out.print("Nilai UAS     :"); n_uas[i]=input.nextInt();
                    double rata=(n_tgas[i]+n_uts[i]+n_uas[i])/3;
                    System.out.println("Nilai rata-rata ="+rata);

                }
                break;
                }
        default:System.exit(0);
        }
        }
static void garis(){
        System.out.println("==========================================");
    }
}