/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Lenovo e440 UC 01
*/
import javax.swing.JOptionPane;
public class coba {
public static void main (String args []){
System.out.print("Kalkulator");
String Input=JOptionPane.showInputDialog("silahkan masukan angka");
String Input1=JOptionPane.showInputDialog("silahkan masukan operan+,-,*,/");
String Input2=JOptionPane.showInputDialog("silahkan masukan angka kedua");
float a=Float.parseFloat(Input);
float c=Float.parseFloat(Input2);
float hasil=0;
if(Input1.equals("+")){
hasil=a+c;
}
else if (Input1.equals("-")){
hasil=a-c;
}
else if (Input1.equals("*")){
hasil=a*c;
}
else if (Input1.equals("/")){
hasil=a/c;
}
System.out.print(a);
System.out.print(Input1);
System.out.print(c);
System.out.println("hasil1");
System.out.println(hasil);
}
Sabtu, 19 April 2014
JOptionPane
02.44
No comments
Langganan:
Posting Komentar (Atom)
0 komentar:
Posting Komentar