package main;

import java.util.Scanner;

import approximation.Lagrange;

/**
 * Main class
 * @author Pavel_Verkhovtsov
 */
public class Main {

	private static double[] y = {2.02, 1.98, 1.67, 1.65, 1.57, 1.42, 1.37, 1.07, 0.85, 0.48, 0.35, -0.30, -0.61, -1.2, -1.39, -1.76, -2.28, -2.81, -3.57, -4.06};
	private static double[] x = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};

	/**
	 * Main method.
	 * @param args console parameters
	 */
	@SuppressWarnings("resource")
	public static void main(final String[] args){
		Lagrange lagrange = new Lagrange(x, y);
		System.out.print("Input approximation point: ");
		double point = new Scanner(System.in).nextDouble();
		System.out.println(lagrange.approximazeFunction(point));
	}
}

package main;

import approximation.Lagrange;

/**
 * Main class
 * @author Pavel_Verkhovtsov
 */
public class Main {

	private static double[] y = {2.02, 1.98, 1.67, 1.65, 1.57, 1.42, 1.37, 1.07, 0.85, 0.48, 0.35, -0.30, -0.61, -1.2, -1.39, -1.76, -2.28, -2.81, -3.57, -4.06};
	private static double[] x = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};

	/**
	 * Main method.
	 * @param args console parameters
	 */
	public static void main(final String[] args){
		Lagrange lagrange = new Lagrange(x, y);
		System.out.println(lagrange.approximazeFunction(2));
	}
}

--- 
+++ 
@@ -1,4 +1,6 @@
 package main;
+
+import java.util.Scanner;
 
 import approximation.Lagrange;
 
@@ -15,8 +17,11 @@
 	 * Main method.
 	 * @param args console parameters
 	 */
+	@SuppressWarnings("resource")
 	public static void main(final String[] args){
 		Lagrange lagrange = new Lagrange(x, y);
-		System.out.println(lagrange.approximazeFunction(2));
+		System.out.print("Input approximation point: ");
+		double point = new Scanner(System.in).nextDouble();
+		System.out.println(lagrange.approximazeFunction(point));
 	}
 }
Add console input approximation point 