Membuat Program Evaluasi Ekspresi JAVA

mport java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class EvaluasiEkspresi {

public EvaluasiEkspresi() {
// TODO Auto-generated constructor stub
}
/**
* Author : ferizal
* @return
*/
public static void main(String[] args) {
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
String nilaiInput;
try{
System.out.println("Masukkan nilainya");
System.out.print("Input : ");
nilaiInput = input.readLine();
System.out.println(nilaiInput);
double nilai = Double.parseDouble(nilaiInput);
double hasil = nilai*nilai*Math.sin(Math.toRadians(45))+Math.sqrt(Math.exp(1)) ;
System.out.println("Output : \n"+hasil);
} catch(IOException e){
System.out.println("gagal membaca keyboard");
}
}
}

0 komentar:

Posting Komentar