new class added for interface and main class modified for taking K value from user