Rabu, 08 Juni 2011

INPUT DATA MENGGUNAKAN ARRAY

import java.util.Scanner;
public class Main {

public static void main(String[] args) {
        Scanner input=new Scanner (System.in);
        int i,k,jum=0;
        double rata;
        String [] NPM=new String [10];
        String [] Nama=new String [15];
        String [] Jur=new String [15];
        String [] mk=new String [15];
        int[] tgs=new int[5];
        int[] uts=new int[5];
        int[] uas=new int[5];


    garis();
    System.out.println("             MENU PILIHAN");
    garis();
    System.out.println("1. MENGHITUNG NILAI MAHASISWA (ARRAY)");
    System.out.println("2. EXIT");
    System.out.println("");
    garis();

    System.out.print("Anda Pilih Nomor =");int pil=input.nextInt();
    switch(pil){
        case 1 :{
            garis();
            System.out.println("MENGHITUNG NILAI MAHASISWA");
            garis();
            System.out.print("MASUKAN JUMLAH MAHASISWA :");int j=input.nextInt();

     
       for (i=0;i<j;i++){
          
           System.out.print("NPM                         :");NPM[i]=input.next();
           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                 :");tgs[i]=input.nextInt();
           System.out.print("NILAI UTS                   :");uts[i]=input.nextInt();
           System.out.print("NILAI UAS                   :");uas[i]=input.nextInt();
       
           rata=(jum+tgs[i]+uts[i]+uas[i])/3;
           System.out.println("NILAI RATA                  :"+rata);
           System.out.println("");
          


    
            } break;
        }
        default:System.exit(0);

       
    }
    }
static void garis(){
    System.out.println("==============================================");
}

}
 

0 komentar:

 
blog design by suckmylolly.com