How can I format the following to 4 decimal places. I wasn't able to use System.out.format("****")
or System.out.printf("****")
System.out.println("\n Two Distinct Complex Roots Exists: root1 = " +
x1 + " + " + imaginary + "i and root2 = " + x2 +" - " +imaginary + "i");
here is the quadratic formula that I'm trying to format
else if (disc < 0) {
x1 = x2 = -b / (2 * a);
imaginary = Math.sqrt(-disc) / (2 * a);
System.out.format("%.3f%n Two Distinct Complex Roots Exists: root1 = " +
x1 + " + " + imaginary + " and root2 = " + x2 +" - " +imaginary);
}