Another issue with do..while
<p>I rewrote my kinda' first program in Java and now it looks like this:</p>

<pre><code>import java.util.*;
import static java.lang.Math.*;

public class FirstApp {
public static void main(String[] args) {

    Scanner input = new Scanner(System.in);
    double a = 0;
    double b = 0;
    double c = 0;
    double delta;
    double x1 = 0, x2 = 0;
    boolean repeat = false;
    boolean decision = false;


    System.out.println("Calculator 2.0");
    System.out.println("Bartosz Kubacki 6.10.2016");
    System.out.println("-------------------------------");
    System.out.println("Welcome in Calculator 2.0 which helps you solve Ax^2 + Bx + C = 0.");

    do
    {
        do 
        {
            System.out.println("Enter A param (different from 0: ");

            if(input.hasNextDouble())
            {
                a = input.nextDouble();
                if(a == 0)
                {
                    System.out.println("Param A needs to be different from 0!");
                }   
            } else
            {
                input.nextLine();
                System.out.println("Param A must be a number!");
            }
        } while(a == 0);

        do
        {
            System.out.println("Enter B param: ");

            if(input.hasNextDouble())
            {
                b = input.nextDouble();
                repeat = false;
            } else
            {
                input.nextLine();
                System.out.println("Param B must be a number!");
                repeat = true;
            }
        } while(repeat);

        do
        {
            System.out.println("Enter C param: ");

            if(input.hasNextDouble())
            {
                c = input.nextDouble();
                repeat = false;
            } else
            {
                input.nextLine();
                System.out.println("Param C must be a number!");
                repeat = true;
            }
        } while(repeat);

        // Counting.. and showing results

        delta = pow(b, 2) - (4 * a * c);
        if(delta == 0)
        {
            x1 = (0 - b) / 2 * a;
            System.out.printf("There is one solution: %.2f\n", x1);
        } else if(delta &gt; 0)
        {
            x1 = ((0 - b) - sqrt(delta)) / 2 * a;
            x2 = (b + sqrt(delta)) / 2 * a;
            System.out.printf("There are two solutions: %.2f and %.2f\n", x1, x2);
        } else
        {
            System.out.println("There is no solution.");
        }

        // Decyzja o kolejnych działaniach

        do
        {
            System.out.println("Want make another eqation? [Y/N] ");
            String dec = null;

            if(input.hasNext("Y") || input.hasNext("N") || input.hasNext("y") || input.hasNext("n"))
            {
                dec = input.nextLine();
                if(dec.equalsIgnoreCase("Y"))
                    decision = true;
                else
                    decision = false;

                repeat = false;
            } else
            {
                input.nextLine();
                repeat = true;
            }
        } while(repeat);
    } while(decision);

    input.close();
}
}
</code></pre>

<p>Everything goes well actually except:</p>

<ol>
<li><p>When I put a non-numeric type while entering values for A, B and C a double warning about that shows and then it works normally.(only 1 warning)</p></li>
<li><p>When I answer Y or N then program terminates, BUT if I will enter anything else like "g" "2" "w" etc., then program asks me again (twice also at the first time) and then when I enter Y or N it works great.</p></li>
</ol>

<p>I really dunno what's that about becouse there are no warnings or errors during compilation.</p>

<p>Thanks for all answers. :)</p>