Specifik : JOptionPane
package JOptPane;
import javax.swing.JOptionPane;
/**
*
* @author BEJI SOKHI
*/
public class Nilai {
public static void main(String[] args) {
int quiz;
int tugas;
int uts;
int uas;
double sum;
String nilaiHuruf = null;
String str1 = JOptionPane.showInputDialog("Input Quiz Value");
quiz = Integer.parseInt(str1);
String str2 = JOptionPane.showInputDialog("Input Assignment Value");
tugas = Integer.parseInt(str2);
String str3 = JOptionPane.showInputDialog("Input Mid-Test Value");
uts = Integer.parseInt(str3);
String str4 = JOptionPane.showInputDialog("Input Final-Test Value");
uas = Integer.parseInt(str4);
sum = (quiz*0.15)+(tugas*0.15)+(uts*0.3)+(uas*0.4);
if (sum<=100 && sum>=85){
nilaiHuruf="A";
} else if (sum<=84 && sum>=70){
nilaiHuruf="B";
}else if (sum<=69 && sum>=55){
nilaiHuruf="C";
}else if (sum<=54 && sum>=40){
nilaiHuruf="D";
}else if (sum>=0 && sum<=39) {
nilaiHuruf="E";} else {
nilaiHuruf="Invalid Value";
}
System.out.println("Quiz Value : "+quiz);
System.out.println("Assignment Value : "+tugas);
System.out.println("Mid-Test Value : "+uts);
System.out.println("Final-Test Value : "+uas);
System.out.println("Your Total Scores is : "+sum);
System.out.println("Grade : "+nilaiHuruf);
System.exit(0);
}
}
NB: Jangan CoPas langsung ya bray