nilai_mahasiswa

import java.io.*;

public class nilai_mahasiswa {
public static void main(String[]args)throws IOException
{
String[] nama=new String[3];
String[] nim=new String[3];
int[] uts= new int[3];
int[] uas= new int[3];
int[] tugas=new int[3];
char[] grade=new char[3];
double[] akhir=new double[3];
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
for(int i=0;i<3;i++){
System.out.print("nama:");nama[i]=br.readLine();
System.out.print("nim:");nim[i]=br.readLine();
System.out.print("Uts:");uts[i]=Integer.parseInt(br.readLine());
System.out.print("uas:");uas[i]=Integer.parseInt(br.readLine());
System.out.print("tugas:");tugas[i]=Integer.parseInt(br.readLine());
}
for (int a=0;a<3;a++){
akhir[a]=(uts[a]+uas[a]+tugas[a])/3;
if(akhir[a]>=85){
grade[a]='a';}
else if(akhir[a]>=75){
grade[a]='b';}
else if(akhir[a]>=50)
{grade[a]='c';}
else if(akhir[a]>=25)
{grade[a]='d';}
else {grade[a]='e';}
}
for(int i=0;i<3;i++){
System.out.println("======================================");
System.out.println("Nama :"+nama[i]);
System.out.println("NIM :"+nim[i]);
System.out.println("UTS :"+uts[i]);
System.out.println("UAS :"+uas[i]);
System.out.println("TUGAS :"+tugas[i]);
System.out.println("Nilai Akhir:"+akhir[i]);
System.out.println("Grade :"+grade[i]);
}
}
}

0 comments: