package task1;

public class Resolver {
	// a!=0
	public Resolver(float a, float b, float c) {
		if (a == 0)
			throw new IllegalArgumentException("a equals zero");
		this.a = a;
		this.b = b;
		this.c = c;
	}
	
	public float getA() { return a; }

	public float getB() { return b; }

	public float getC() { return c; }

	
	public Root<Double, Double> resolve() {
		if (!isResolved) {
			double discr = Discriminant();
		
			if (discr > 0) {
				double discrSqrt = Math.sqrt(discr);
				double x1 = (-b + discrSqrt) / (2d * a);
				double x2 = (-b - discrSqrt) / (2d * a);
				result = new Root<Double, Double>(x1, x2);
			} else if (discr == 0) {
				double x = - b / (2d * a);
				result = new Root<Double, Double>(x, x);
			} else
				result = null;
		}
			isResolved = true;
		
		return result;
	}

	
	public double Discriminant() {
		return (double) b * b - 4d * a * c;
	}

	private float a;
	private float b;
	private float c;
	private Root<Double, Double> result;
	private boolean isResolved;
}

@@ -41,12 +41,45 @@
 %09// 
-a
+%D0%A1%D0%BE%D0%B7%D0%B4%D0%B0%D0%BD%D0%B8%D0%B5 %D0%BA%D0%B2%D0%B0%D0%B4%D1%80%D0%B0%D1%82%D0%BD%D0%BE%D0%B3%D0%BE %D1%83%D1%80%D0%B0%D0%B2%D0%BD%D0%B5%D0%BD%D0%B8%D1%8F (%D0%B0
 !=0
+)
 %0A%09pu
@@ -343,24 +343,69 @@
 turn c; %7D%0A%0A%09
+/// %D0%A0%D0%B5%D1%88%D0%B5%D0%BD%D0%B8%D0%B5 %D1%83%D1%80%D0%B0%D0%B2%D0%BD%D0%B5%D0%BD%D0%B8%D1%8F - %D0%BA%D0%BE%D1%80%D1%82%D0%B5%D0%B6 %D1%81 %D0%BA%D0%BE%D1%80%D0%BD%D1%8F%D0%BC%D0%B8/null
 %0A%09public Roo

Update Resolver.java