Contoh Program Java Menentukan Grade Nilai
class Niai{
public static void main(String args[]){
int grade = 90;
if( grade >= 101 ) {
System.out.println( "ERROR!!!" );
System.out.println( "ERROR!!!" );
System.out.println( "ERROR!!!" );
}
else if( (grade >= 86 ) && (grade <= 100) )
{
System.out.println( "Grade : A" );
System.out.println( "Anda Lulus!!!" + "Exelent!!!" );
}
else if( (grade >= 71 ) && (grade <= 85) )
{
System.out.println("Grade : B" );
System.out.println( "Anda Lulus!!!" + "Good!!!" );
}
else if( (grade >= 46) && (grade <= 70) )
{
System.out.println("Grade : C" );
System.out.println( "Anda Lulus!!!" );
}
else if( (grade >= 1)&& (grade <= 45))
{
System.out.println("Grade : D" );
System.out.println( "Harap Mengulang!!!" );
}
else
{
System.out.println("Grade : E");
System.out.println( "Anda Gagal!!!" );
}
}
}
Comments
Post a Comment