Home » , » contoh script java class hitungnilai

contoh script java class hitungnilai

import java.util.Scanner;
class HitungNilai{
public static void main(String args[]){
Scanner baca = new Scanner(System.in);

String nama;
double uts,uas;

System.out.print("Nama : "); nama = baca.nextLine();
System.out.print("Nilai UTS : "); uts = baca.nextDouble();
System.out.print("Nilai UAS : "); uas = baca.nextDouble();

double nilaiAkhir = (uts+uas)/2;

System.out.println("Untuk "+nama);

if (nilaiAkhir >=55) System.out.print("Selamat, ");

if (nilaiAkhir >=55){
System.out.println("Anda lulus");
} else {
System.out.println("Anda tidak lulus");
}
}
}

0 komentar:

Posting Komentar