Program

The final program can be seen here