UNKNOWN //************************************** // Name: Akar Kembar // Description:mencari akar kembar, x1 dan x2 // By: Mr. SNMP Simamora // // // Inputs:bilangan integer: ax^2 + bx + c // // Returns:bilangan integer (positip atau negatip) // //Assumes:None // //Side Effects:dang adong... //This code is copyrighted and has limited warranties. //Please see http://www.Planet-Source-Code.com/xq/ASP/txtCodeId.6585/lngWId.2/qx/vb/scripts/ShowCode.htm //for details. //************************************** import javax.swing.JOptionPane; public class persFK1 { public static void main(String args[]) { double x1,x2,a,b,c,z,v; System.out.println("Bentuk PFK: ax^2+bx+c"); String a1=JOptionPane.showInputDialog("Masukkan a:"); a=Double.parseDouble(a1); String b1=JOptionPane.showInputDialog("Masukkan b:"); b=Double.parseDouble(b1); String c1=JOptionPane.showInputDialog("Masukkan c:"); c=Double.parseDouble(c1); z=b*b-4*a*c; v=Math.sqrt(z); x1 = (-1*b+v)/(2*a); x2 = (-1*b-v)/(2*a); System.out.println("x1 = " + x1); System.out.println("x2 = " + x2); System.exit(0); } }