What programs and remember no one can write the programs for you here. Just can help you in the process of writing programs / code.

Try going through Before you make a query.