This was one of my computer science projects. Below are the screenshots and the code.

Screenshots

Code