// here is the code for the main method
**refer to the link in post #4**