Nah postingan kali ini akan membahas bagaimana caranya membuat perhitungan menghitung hasil nilai ujian dengan menggunakan java / netbeans, silahkan simak ,
Syntax Program
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package nilaiujian;
import java.util.Scanner;
/**
*
* @author Agri Kuswandani
*/
class masukan{
void data(){
int nim;
String nama,kelas,mk;
Scanner input =new Scanner(System.in);
System.out.println("NIM : ");
nim=input.nextInt();
System.out.print("Nama : ");
nama=input.next();
System.out.print("Kelas: ");
kelas=input.next();
System.out.print("MK : ");
mk=input.next();
System.out.println();
}
float nilai(){
{int nim;
String nama,kelas,mk;
Scanner input =new Scanner(System.in);
System.out.println("NIM : ");
nim=input.nextInt();
System.out.print("Nama : ");
nama=input.next();
System.out.print("Kelas: ");
kelas=input.next();
System.out.print("MK : ");
mk=input.next();
System.out.println();}
float tgs1,tgs2,uts,uas,tmbahan;
Scanner input = new Scanner(System.in);
System.out.print("Nilai Tugas 1 = ");
tgs1=input.nextInt();
System.out.print("Nilai Tugas 2 = ");
tgs2=input.nextInt();
System.out.print("Nilai UTS = ");
uts=input.nextInt();
System.out.print("Nilai UAS = ");
uas=input.nextInt();
System.out.print("Nilai Tambahan = ");
tmbahan=input.nextInt();
return (float)((tgs1*0.15)+(tgs2*0.15)+(uts*0.3)+(uas*0.3)+(tmbahan*0.1));
}
}
public class NilaiUjian {
private static String ket;
public static void main(String[] args) {
masukan data = new masukan ();
Scanner input = new Scanner(System.in);
float hasil = data.nilai();
if (hasil > 85 && hasil <= 100){
ket="A Ket Baik Sekali";
}else if (hasil > 75 && hasil <= 85){
ket="B Ket Baik";
} else if (hasil > 60 && hasil <= 75){
ket="C Ket Cukup";
} else if (hasil <= 59){
ket="D Ket Buruk";
}
System.out.println("Nilai Total : "+hasil);
System.out.println("Nilai Total : "+ket);
}
}
Program menghitung Nilai Ujian dengan Java / Netbeans |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package nilaiujian;
import java.util.Scanner;
/**
*
* @author Agri Kuswandani
*/
class masukan{
void data(){
int nim;
String nama,kelas,mk;
Scanner input =new Scanner(System.in);
System.out.println("NIM : ");
nim=input.nextInt();
System.out.print("Nama : ");
nama=input.next();
System.out.print("Kelas: ");
kelas=input.next();
System.out.print("MK : ");
mk=input.next();
System.out.println();
}
float nilai(){
{int nim;
String nama,kelas,mk;
Scanner input =new Scanner(System.in);
System.out.println("NIM : ");
nim=input.nextInt();
System.out.print("Nama : ");
nama=input.next();
System.out.print("Kelas: ");
kelas=input.next();
System.out.print("MK : ");
mk=input.next();
System.out.println();}
float tgs1,tgs2,uts,uas,tmbahan;
Scanner input = new Scanner(System.in);
System.out.print("Nilai Tugas 1 = ");
tgs1=input.nextInt();
System.out.print("Nilai Tugas 2 = ");
tgs2=input.nextInt();
System.out.print("Nilai UTS = ");
uts=input.nextInt();
System.out.print("Nilai UAS = ");
uas=input.nextInt();
System.out.print("Nilai Tambahan = ");
tmbahan=input.nextInt();
return (float)((tgs1*0.15)+(tgs2*0.15)+(uts*0.3)+(uas*0.3)+(tmbahan*0.1));
}
}
public class NilaiUjian {
private static String ket;
public static void main(String[] args) {
masukan data = new masukan ();
Scanner input = new Scanner(System.in);
float hasil = data.nilai();
if (hasil > 85 && hasil <= 100){
ket="A Ket Baik Sekali";
}else if (hasil > 75 && hasil <= 85){
ket="B Ket Baik";
} else if (hasil > 60 && hasil <= 75){
ket="C Ket Cukup";
} else if (hasil <= 59){
ket="D Ket Buruk";
}
System.out.println("Nilai Total : "+hasil);
System.out.println("Nilai Total : "+ket);
}
}
0 komentar
Posting Komentar