import java.applet.Applet;
import java.awt.Graphics;
import javax.swing.*;
public class appletbilterbesar extends Applet {
double max;
public void init() {
String firstnumber;
String secondnumber;
String thirdnumber;
double n1;
double n2;
double n3;
firstnumber = JOptionPane.showInputDialog("Masukkan Angka Pertama");
secondnumber = JOptionPane.showInputDialog("Masukkan Angka Kedua");
thirdnumber = JOptionPane.showInputDialog("Masukkan Angka Ketiga");
n1=Double.parseDouble(firstnumber);
n2=Double.parseDouble(secondnumber);
n3=Double.parseDouble(thirdnumber);
if (n1>n2 && n1>n3){
max=n1;
} else
if(n2>n1 && n2>n3){
max = n2;
} else {
max = n3;
}
}
public void paint(Graphics g)
{
super.paint(g);
g.drawRect(15,10,270,20);
g.drawString("Bilangan Terbesar Adalah " +max, 25,25);
}
}
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar