You've posted several of these questions now, and all I can assume is that you have a list of homework questions and you want us to just answer them for you rather than learning anything yourself...we're not going to. If you have any programming problems that you've made a legitimate attempt at and cannot figure out then please post them and we will help.
Since you are opening like 5 threads all with the same title all with questions you get asked after day 1, and the questions simply imply you neither paid attention during class nor feel like just looking your answers up, I created a program that does it for you.
@hanst99, can I kindly ask how that program does what it does. I couldn't help to compile it as I knew it would involve some type of sarcasm directed towards the poster.