SKRIP STREAMREADER KE SCANNER
package Scanner;
import java.util.Scanner;
public class InpExp {
public static int Nilai;
private static String nama;
public static void main(String[]args){
String nama;
String nilai = "";
Scanner in = new Scanner (System.in);
System.out.print("Name:");
nama = in.nextLine ();
System.out.println("NIM :E4110384");
System.out.println("KOTA ASAL:LUMAJANG");
System.out.print("nilai:" );
nilai = in.nextLine();
in.close();
int Nilai = Integer.parseInt(nilai);
if(Nilai>=0 && Nilai<=50)
{System.out.println("TIDAK LULUS");
}
else if(Nilai>=51 && Nilai<=70)
{System.out.println("B");
}
else if(Nilai>=71 && Nilai<=100)
{System.out.println("A");
}
else
{System.out.println("SALAH MASUKKAN NILAI");
}
}
}
Komentar
Posting Komentar