M6_nili jop
pertemuan 6 ap1
/*
* 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 Matkul;
/**
*
* @author kumal
*/
import javax.swing.JOptionPane;
public class M6_nilaiJOP {
public static void main(String[] args) {
double A = Double.parseDouble(JOptionPane.showInputDialog("Masukkan nilai A"));
double B = Double.parseDouble(JOptionPane.showInputDialog("Masukkan Nilai B"));
double C = Double.parseDouble(JOptionPane.showInputDialog("Masukkan Nilai C"));
double r = (A+B+C)/3;
if (r>=60) {
JOptionPane.showMessageDialog(null, "Nilai A: " + A + "\nNilai B: " + B + "\nNilai C: " + C + String.format("\n\nNilai rata-rata : %.2f", r) + " :-)");
} else {
JOptionPane.showMessageDialog(null, "Nilai A: " + A + "\nNilai B: " + B + "\nNilai C: " + C + String.format("\n\nNilai rata-rata : %.2f", r) + " :-(");
}
}
}
