SHARE
TWEET

nilaimahasiswa

anggayuliandierpanda Sep 16th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class nilaimahasiswa {
  4.     public static void main (String [] hady){
  5.         Scanner input = new Scanner (System.in);
  6.         String nama , nim ;
  7.         char grade ;
  8.         final double n_tugas , n_uts , n_uas , n_akhir;
  9.         System.out.println("\n Menghitung Nilai Mahasiswa\n");
  10.         System.out.print("Masukan nama : ");
  11.         nama = input.nextLine();
  12.         System.out.print("Masukan NIM : ");
  13.         nim = input.nextLine();
  14.         System.out.print("Nilai tugas : ");
  15.         n_tugas = input.nextInt();
  16.         System.out.print("Nilai uts : ");
  17.         n_uts = input.nextInt();
  18.         System.out.print("Nilai uas : ");
  19.         n_uas = input.nextInt();
  20.         n_akhir = (0.25 * n_tugas + 0.30 * n_uts + 0.50 * n_uas);
  21.         if (n_akhir >= 85 && n_akhir <=100){
  22.             grade = 'A';
  23.         }
  24.         else if (n_akhir > 75 && n_akhir < 85){
  25.             grade = 'B';
  26.         }
  27.         else if (n_akhir > 65 && n_akhir < 75){
  28.             grade = 'C';
  29.         }
  30.         else if (n_akhir > 50 && n_akhir < 65){
  31.             grade = 'D';
  32.         }
  33.         else {
  34.             grade = 'E';
  35.         }
  36.         if (grade == 'A' || grade == 'B' || grade == 'C'){
  37.             System.out.println("\n"+nama+" dengan NIM "+nim+" memiliki nilai akhir "+n_akhir+" = ("+grade+")"+""
  38.                     + "\n Dinyatakan Lulus Maga Kuliah");
  39.         }
  40.         else {
  41.             System.out.println("\n"+nama+" dengan NIM "+nim+" memiliki nilai akhir "+n_akhir+" = ("+grade+")"+""
  42.                     + "\n Dinyatakan Tidak Lulus Mata Kuliah");
  43.         }  
  44.     }
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top