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");

}

}

}



Share this:

Enter your email address to get update from Kompi Ajaib.

Tidak ada komentar