completed program to take input from user