The functionality you described is detached from any kind of application in reality. Therefore I assume it is a pure exercise that was given in school. If my assumption is wrong, please describe the application it has in reality.
The way you ask suggests that what you are really trying to say is:
Can someone just write this program for me quickly?
Can yes want no. My understanding of this forum is helping people to help themselves.
Write your own first attempt at what the program could look like. Then post this program and ask a specific question. If you work like this and everyone can see that you put your own effort and your own learning into the task, then this forum will be happy to help you.
best regards Stefan