Script :
import javax.swing.JOptionPane;
public class T3_JOptionPane {
public static void main(String[] args) {
int bil1, bil2, bil3, counter;
float average;
String input1 = JOptionPane.showInputDialog("Masukkan Bilangan ke-1 :");
bil1 = Integer.parseInt(input1);
String input2 = JOptionPane.showInputDialog("Masukkan Bilangan ke-2 :");
bil2 = Integer.parseInt(input2);
String input3 = JOptionPane.showInputDialog("Masukkan Bilangan ke-3 :");
bil3 = Integer.parseInt(input3);
counter = bil1 + bil2 + bil3;
average = counter / 3;
String msg = "Jumlah Bilangan : " + counter + "\n Rata -Rata Bilangan : " + average;
JOptionPane.showMessageDialog(null, msg);
}
}
Implementasi :
0 komentar:
Posting Komentar