Buatlah Program Java yang menjelaskan tentang penentuan nilai
a. A -> 80 - 100
b. B -> 70 - 79
c. C -> 55 - 69
d. D -> 35 - 54
e. E -> 0 - 34
Berikut jawaban untuk program java diatas :
public class NilaiIf {Tampilan :
public static void main(String[] args) {
double nilai;
char grade;
Scanner scan = new Scanner(System.in);
System.out.print("Masukan Nilai : ");
nilai = scan.nextDouble();
if (nilai >= 80){
grade = 'A';
}else if(nilai >= 65){
grade = 'B';
}else if(nilai >= 55){
grade = 'C';
}else if(nilai >= 45){
grade = 'D';
}else {
grade = 'E';
}
System.out.println("Nilai: "+nilai);
System.out.println("Grade: "+grade);
}
}
0 Response to "Code Program Menampilkan Nilai (A >= 80, dan seterusnya)"
Posting Komentar