If you want to write a program then you should create a flowchart of what you want it to do.