changed the program to be used with arguments or with a scanner, depending on the existence of arguments