Senin, 24 Januari 2011

Latihah java Class nilai

import java.io.*;

public class nilai{
private static BufferedReader datain = new BufferedReader (new InputStreamReader (System.in));
private static String nim[] = new String [10];
private static String nama[] = new String [10];
private static String prodi[] = new String [10];
private static int absen[] = new int [10];
private static int tugas[] = new int [10];
private static int uts[] = new int [10];
private static int uas[] = new int [10];
private static double na[] = new double [10];
private static String index[] = new String [10];
private static String ket[] = new String [10];

private static int i;
private static double max,min;
private static int pilih;
private static String tekan = "";
static int jum;



// main program
public static void main(String args[]) throws IOException{

System.out.println
("Main Program");
System.out.println(" Silakan pilih menu ");


do{
System.out.println();
System.out.println(" MENU UTAMA ");
System.out.println(" ----------------------");
System.out.println(" 1 Input Data ");
System.out.println(" 2 Tampil Data");
System.out.println(" 3 Terbesar");
System.out.println(" 4 Terkecil");
System.out.println(" 0 Keluar ");
System.out.println();
System.out.print(" Pilihan Anda : ");

pilih = Integer.parseInt(datain.readLine());


switch(pilih){
case 1 : input();
break;
case 2: tampil();
break;
case 3: terbesar();
break;
case 4: terkecil();
break;
case 0: System.out.println(" Anda Memilih Keluar");
System.out.println(" TerimakasiH");
break;
default:
System.out.println(" Anda Salah Memilih ");


}


}while (pilih !=0);


System.out.println();
}


// Input
public static void input() throws IOException{
System.out.print(" Program Input ");
System.out.println(" Anda Memilih Input Data ");
System.out.println();
System.out.print(" MAsukan Jumlah datA : ");

jum = Integer.parseInt(datain.readLine());
for (i=1;i<=jum;i++){ System.out.print(" Masukan Nim ke " +i +" : "); nim[i] = datain.readLine(); System.out.print(" Masukan Nama ke " +i +" : "); nama[i] = datain.readLine(); //System.out.print(" Masukan Prodi ke " +i +" : "); //prodi[i] = datain.readLine(); System.out.print(" Masukan Nilai Absensi ke " +i +" : "); absen[i] = Integer.parseInt(datain.readLine()); System.out.print(" Masukan Nilai Tugas ke " +i +" : "); tugas[i] = Integer.parseInt(datain.readLine()); System.out.print(" Masukan Nilai UTS ke " +i +" : "); uts[i] = Integer.parseInt(datain.readLine()); System.out.print(" Masukan Nilai UAS ke " +i +" : "); uas[i] = Integer.parseInt(datain.readLine()); System.out.println(" ------------------"); na[i] = (0.1*absen[i])+(0.2*tugas[i])+(0.3*uts[i])+(0.4*uas[i]); if (na[i] >100)
{
index[i] = "Error";
ket[i] = "NIlia terlalu besar";
}
else if (na[i] >=85 & na[i]<=100) { index[i] = "A"; ket[i] = "Istimewa"; } else if (na[i] >=70 & na[i]<85)>=55 & na[i]<70)>=30 & na[i]<55) i="1;i<="jum;i++){" max =" na[1];" i =" 1;i<="jum;i++){" max =" na[i];" min =" na[1];" i =" 1;i<="jum;i++){"> na[i]){
min = na[i];
}

}
System.out.println("Siswa yang memperoleh Nilai Terkecil Adalah : ");
//System.out.println("Nim \t : " +nim[i]);
//System.out.println("Nama \t : " +nama[i]);
System.out.println("Nilai Akhir \t : " +min);
//System.out.println("Index \t : " +index[i]);
//System.out.print (" Nilai Siswa terbesar : " +max);

}

}

Tidak ada komentar:

Home Again

Bismillah Waktunya pulang.. Alhamdulillah