- Back to Home »
- Percabangan Java
Posted by : Unknown
Tuesday, April 26, 2016
Nama : Asep Kurniawan
NPM : 31114733
Kelas : 2DB01
Script :
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package percabangan;
/**
*
* @author Asep
*/
import javax.swing.JOptionPane;
public class Percabangan {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String NPM;
NPM = JOptionPane.showInputDialog ("NPM anda :");
String Nama;
Nama = JOptionPane.showInputDialog("Nama anda :");
String a;
a = JOptionPane.showInputDialog ("Tugas 1 :");
String b;
b = JOptionPane.showInputDialog("Tugas 2 :");
String c;
c = JOptionPane.showInputDialog("Tugas 3 :");
String UTS;
UTS = JOptionPane.showInputDialog("Nilai UTS :");
String Prak;
Prak = JOptionPane.showInputDialog("Nilai Praktikum :");
String UAS;
UAS = JOptionPane.showInputDialog("Nilai UAS :");
int Uts = Integer.parseInt(UTS);
int Uas = Integer.parseInt(UAS);
int Pra = Integer.parseInt(Prak);
int angka1 = Integer.parseInt(a);
int angka2 = Integer.parseInt(b);
int angka3 = Integer.parseInt(c);
int jum = angka1+angka2+angka3 ;
int rata = jum / 3;
double NA = (0.45*Uts)+(0.15*Uas)+(0.2*Pra)+(0.2*jum);
JOptionPane.showMessageDialog(null,"Rata-ratanya adalah " +rata );
JOptionPane.showMessageDialog(null,"Nilai Akhir = " + NA );
if (NA>=80){
JOptionPane.showMessageDialog(null,"Nilai Mutu anda adalah A " );
} else if (NA >=70 ) {
JOptionPane.showMessageDialog(null,"Nilai Mutu anda adalah B " );
}
else if (NA >=60 ) {
JOptionPane.showMessageDialog(null,"Nilai Mutu anda adalah C " );
}
else if (NA >=50 ) {
JOptionPane.showMessageDialog(null,"Nilai Mutu anda adalah D ");
}
else {
JOptionPane.showMessageDialog(null,"Nilai Mutu anda adalah E " );
}
JOptionPane.showMessageDialog(null,"Nilai Mata Kuliah Pemrograman Java \n\n"+
" Nama = " +Nama+
" \n NPM = "+NPM+
"\n Rata-Rata = "+rata+
"\n Nilai UTS = "+Uts+
"\n Nilai UAS = "+Uas+
"\n Nilai Praktikum = "+Pra+
"\n Nilai Akhir = "+NA);
}
}