# Need next step with the a Java program

I'm taking a Java class and I'm stuck with a program. I completed as much as I can, but now I have no idea how to proceed. I missed half the class while I was recovering from an injury so I have yet to master how to make classes. Please see the code below. I got the code to do the printing of the results of the quadratic equation and how it needs to be concatenated. I now need to break this down into three different classes.

``````// TO DO: Create 3 classes
/*
One will get the coefficient for the A, B, and C terms and returns the number to the driver class - Note: This works but needs to be its own class.

One that calculates the zeros. This will have the three numbers passed into it.  - Note: Needs coding first

You must use the quadratic formula. You will calculate real and imaginary roots. - Note: quadratic formula created and works great.

You must use two methods
1. One that will calculate the right root
2.  the other that will calculate the left root. If your root is imaginary, then and āIā must be concatenated.

One that prints the zeros. This will be called from the class that you calculate the zeros.
Also print the equation ax2 + bx + c where a, b, and c are the numbers you entered.

The one driver class.
Call the resource classes and pass data between them.
*/

// Java Program to find Roots of a Quadratic Equation
import java.util.Scanner;

public class Main {
public static void main(String[] args)
{
double a, b, c;
double root1, root2, complex1, complex2, imaginary, result;
Scanner input = new Scanner(System.in);

System.out.print("Enter your case numbers below\n\n Input a: ");
a = input.nextDouble();
System.out.print("Input b: ");
b = input.nextDouble();
System.out.print("Input c: ");
c = input.nextDouble();

result = Math.pow(b,2) - 4 * a * c;

// *** Print quadratic equation results ***

// Condition for real and different roots

if(result > 0)
{
root1 = (-b + Math.pow(result, 0.5)) / (2 * a);
root2 = (-b - Math.pow(result, 0.5)) / (2 * a);
System.out.format("\nTwo distinct real roots: root 1 = %.0f and root 2 = %.0f", root1, root2);
}

// Condition for real and equal roots
// When the root is a single number, only the single number should print.
else if(result == 0)
{
root1 = root2 = -b/(2 * a);
System.out.format("\nTwo equal and real roots. We are only printing a single number = %.0f", root1);
}

// Let's do the imaginary numbers.
else if(result < 0)
{
root1 = root2 = -b / (2 * a);
imaginary = Math.sqrt(-result) / (2 * a);

/*
Technically this is incorrect because you can not combine the
imaginary and real roots. Output in this format for evaluation only.
If root is imaginary, then and āiā must be concatenated.
*/
complex1 = root1 + imaginary;
complex2 = root2 - imaginary;
System.out.format("\nThis result has imaginary roots, Root 1 = %.3fi and Root 2 = %.3fi", complex1, complex2);
}
}
}
``````