public static void main(String[] args) {
		double a, b;
		Func f = new Func();
		ArrayList<String> al = new ArrayList<String>();

		try(Scanner in = new Scanner(System.in)) {
			
		
			System.out.println("Enter operation:");
	
			while(in.hasNext()) {
				al.clear();
				String str = in.nextLine();  // read line from console
				System.out.println(str);
				if(str.equals("quit")) break; // away from loop
				
				//divide string into tokens
				StringTokenizer st = new StringTokenizer(str, "+-*/", true); // true - delimeter as token
				if(st.countTokens() != 3) {
					System.out.println("Input Error");
					continue; // back to loop
				}
				while(st.hasMoreTokens()) {
					String tok = st.nextToken();
					tok = tok.trim();
					al.add(tok); // add tokens to ArrayList
					System.out.print(tok + " ");
				}
				System.out.println();
				System.out.println(al);
				
				// Convert String tokens to double
				try { // Catch invalid input
					a = Double.parseDouble(al.get(0));  
					b = Double.parseDouble(al.get(2));
				} catch(NumberFormatException e) {
					System.out.println("Number format exception!");
					break;
				}
				
				// Operator determination
				switch(al.get(1)) {
				case "+":
					System.out.println(f.summary2(a, b));
					break;
				case "-":
					System.out.println(f.subtraction2(a, b));
					break;
				case "*":
					System.out.println(f.multiplication2(a, b));
					break;
				case "/":
					double div = f.division2(a, b);
					System.out.print(div);
					/*if(div == Infinity || NaN) !Not work!
						System.out.println(" Oops. Division by zero.");
					*/	
					break;
				default:
					System.out.println("Wrong operation");
					
				}
			} 	

		}
		System.out.println("calculator closed");
	}