- Back to Home »
- Application »
- AP nilai tambahan
import java.io.*;
public class LatihanUjianPraktikumAP1 {
public static void main(String[] args) throws Exception{
DataInputStream masuk = new DataInputStream(System.in);
String strnilai = null;
String matkul = null;
try{
System.out.print("Masukkan Mata Kuliah Anda : ");
matkul = masuk.readLine();
System.out.print("Masukkan Nilai Ujian Anda [0 - 100] :");
strnilai = masuk.readLine();
System.out.println();
}catch(IOException e){}
int nilai = Integer.parseInt(strnilai);
if(nilai >=90 && nilai <=100){
System.out.println("Nilai Mata Kuliah "+matkul+" Anda = A");
}
else if(nilai >=80 && nilai <=89)
{
System.out.println("Nilai Mata Kuliah "+matkul+" Anda = B");
}
else if(nilai>=60 && nilai <=79)
{
System.out.println("Nilai Mata Kuliah "+matkul+" Anda = C");
}
else if(nilai >= 50 && nilai <=59)
{
System.out.println("Nilai Mata Kuliah "+matkul+" Anda = D");
}
else
{
System.out.println("Nilai Mata Kuliah "+matkul+" Anda = E");
}
}
}
screenshot
Sip benar +10 point
BalasHapus