This indeed looked a lot like homework, sorry if I offended you in any way.
The yes command can possibly be uesd. It is possible to change the default output, which is y, to anything you need/want.
yes No will output a string of No's.
yes No | commandthatneedsinput | .... | ....
Hope this helps.